Stream: beginners

Topic: Record accessor example snippet crashes the repl


view this post on Zulip Nicholas Cahill (Feb 24 2022 at 01:48):

The record accesor example snippet from the readme is crashing the repl for me at the moment.

» returnFoo = \x -> x.foo
…
… returnFoo { foo: "hi!", bar: "blah" }

"hi!" : Str

»
… returnFoo = .foo
…
… returnFoo { foo: "hi!", bar: "blah" }
thread '<unnamed>' panicked at 'TODO turn fn_var into a RuntimeError UnresolvedTypeVar(118)', compiler/mono/src/ir.rs:821:35
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

It looks like they're both getting the same type signature, but for some reason it's not solving for the Str type

» returnFoo = .foo
… returnFoo

<function> : { foo : a }* -> a

» returnFoo = \x -> x.foo
… returnFoo

<function> : { foo : a }* -> a

view this post on Zulip Ayaz Hafiz (Feb 24 2022 at 02:23):

Thanks for the find! Can you file a bug for this please?

view this post on Zulip Nicholas Cahill (Feb 24 2022 at 03:21):

Submitted! https://github.com/rtfeldman/roc/issues/2567

view this post on Zulip Ayaz Hafiz (Feb 24 2022 at 04:41):

Thank you!! :thank_you:


Last updated: Jul 05 2025 at 12:14 UTC