Stream: beginners

Topic: weird compiler error when destructuring


view this post on Zulip Ghislain (Oct 04 2022 at 18:38):

I cannot understand why this produces an error:

{ card, num } = { card: [], num: 1 }
List.map card \n ->
    when n is
        Not v if v == num -> Found v
        _ -> n
thread 'main' panicked at 'Error in alias analysis: error in module ModName("UserApp"), function definition FuncName("\x00\x00\x00\x00\x0f\x00\x00\x00\x1b3\xaaX\xc0\x0bk\x7f"), definition of value binding ValueId(11): expected type '((heap_cell, bag<union { ((),), ((),) }>), ())', found type '((heap_cell, bag<()>), ())'', crates/compiler/gen_llvm/src/llvm/build.rs:4504:23

while this don't (keep tags, no destructuring):

card = []
num = 1
List.map card \n ->
    when n is
        Not v if v == num -> Found v
        _ -> n

neither this (removing tags, still destructuring):

{ card, num } = { card: [], num: 1 }
List.map card \n ->
    when n is
        v if v == num -> v
        _ -> n

view this post on Zulip Brendan Hansknecht (Oct 04 2022 at 19:30):

Can you file a GitHub issue? This seems like a proper bug

view this post on Zulip Brendan Hansknecht (Oct 04 2022 at 19:30):

A minimal repro would be great.


Last updated: Jul 06 2025 at 12:14 UTC