You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A mismatch between the naming of a record field in its type annotation and its definition/usage causes a compiler panic. This issue occurs under specific conditions involving optional fields in records.
Steps to Reproduce
The following minimal example reproduces the issue:
main! = \_ ->
_ = foo { bar: 1, baz: 1 }
Ok {}
foo : { qux ? U16, baz : U8 } -> U8foo = \{ bar ? 0, baz } ->
if bar ==0then0else
baz
Conditions
The panic occurs when:
A function takes a record with two or more fields, one of which must be optional.
The optional record field is a number type of U16/I16 or larger, Str, Bool, or possibly others (does not apply to U8/I8).
The optional field has one name in the type annotation but a different name is used in the definition, and the name from the definition is used in the function call.
Expected Behavior
The compiler should emit a type-checking error indicating the field name mismatch instead of panicking.
Actual Behavior
The compiler produces the following panic:
thread 'main' panicked at crates/compiler/gen_llvm/src/llvm/build.rs:5582:19:
Error in alias analysis: error in module ModName("UserApp"), function definition FuncName("\x11\x00\x00\x00\x01\x00\x00\x00\x90\x7f\x81\xfe\xe6S\xe3K"), definition of value binding ValueId(3): tuple field index 2 out of range
Additional Notes
Reversing the types of the optional and non-optional fields (e.g., making the optional field U8 and the non-optional field U16) does not trigger the error, indicating the issue is not based on the total size of the record.
The text was updated successfully, but these errors were encountered:
Type := { a : U8, b : U8 } # This will NOT trigger the bug, but changing a OR b to U16 will.main! = \_ ->
_ = foo { bar: { a: 1, b: 1 }, baz: 1 }
Ok {}
foo : { qux ? Type, baz : U8 } -> U8foo = \{ bar ? { a: 0, b: 0 }, baz } ->
if bar.a==0then0else
baz
Description
A mismatch between the naming of a record field in its type annotation and its definition/usage causes a compiler panic. This issue occurs under specific conditions involving optional fields in records.
Steps to Reproduce
The following minimal example reproduces the issue:
Conditions
The panic occurs when:
U16
/I16
or larger,Str
,Bool
, or possibly others (does not apply toU8
/I8
).Expected Behavior
The compiler should emit a type-checking error indicating the field name mismatch instead of panicking.
Actual Behavior
The compiler produces the following panic:
Additional Notes
The text was updated successfully, but these errors were encountered: