hey y'all running into a compiler panic when trying to work with dicts. This is the error I'm getting
thread '<unnamed>' panicked at crates/compiler/mono/src/ir.rs:6166:56:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
and this is the code causing it
partOne = \(rules, updates) ->
rulesDict = List.walk rules (Dict.empty {}) \dict, (k, r) ->
Dict.update dict k \res -> when res is
Err Missing -> Ok [r]
Ok rs -> Ok (List.append rs r)
rulesDict
was hoping someone could point me to a workaround
Does it help if you add a type annotation for rulesDict
or the function?
I suspect the issue here might be that the compiler is having trouble inferring the type for the Dict
it does! thank you :)
Ideally the compiler shouldn't crash, and at least give a nice error message.
I've had a brief look at it, but mono is a bit of black magic to me and I'm not sure how we might thread an error back through the compiler from there.
Two things about mono errors:
Last updated: Jul 06 2025 at 12:14 UTC