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
{{ message }}
Repository navigation
Bug: Option array literals with Some payloads fail codegen #586
An array literal whose element type is Option[T] fails MIR/codegen when one or more elements are Some(payload). The compiler reports aggregate enum payload missing destination payload type instead of lowering the aggregate.
This was discovered while adding #439 for-loop pattern tests. The #439 test now uses a Vec[?i32] sequence so it can exercise for-pattern filtering without depending on this aggregate-codegen bug.
Fixed by the commit above: array-literal elements now lower under the array's ELEMENT type instead of the leaked ambient annotation type (NK_ARRAY_LIT per-element expected_type rebind, the NK_TUPLE pattern). let opts: [?i32; 3] = [Some(1), None, Some(4)] and the un-annotated form both work with correct values — the un-annotated form was previously SILENTLY CORRUPTED, which this fix also cures. Pinned by behav_option_array_literal (value asserts, both forms). Note: the length-less [?i32] BINDING annotation is a separate pre-existing bug (not a spec type, corrupt slice view) — filed as #622 with a plain-int repro. §4.3c; full gates green.
Activity
ehartford commentedon Jul 2, 2026
Fixed by the commit above: array-literal elements now lower under the array's ELEMENT type instead of the leaked ambient annotation type (NK_ARRAY_LIT per-element expected_type rebind, the NK_TUPLE pattern).
let opts: [?i32; 3] = [Some(1), None, Some(4)]and the un-annotated form both work with correct values — the un-annotated form was previously SILENTLY CORRUPTED, which this fix also cures. Pinned by behav_option_array_literal (value asserts, both forms). Note: the length-less[?i32]BINDING annotation is a separate pre-existing bug (not a spec type, corrupt slice view) — filed as #622 with a plain-int repro. §4.3c; full gates green.Fix enum-variant construction typing in MIR lowering (#566, #586)
test: coverage-sweep batch 2 (#483 #484 #522 #493 #494 #514 #515 #532)
MIR: lower comparison operands with the other operand's expected type (…