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
D43: a partial match tail with equal written-arm types infers a value and reads an unwritten result #1889
D43 (§9.1) says a missing arm makes an unannotated function's tail Unit. A partial match whose written arms all have the same non-Unit type instead keeps that type and reads an unwritten result on its no-match path.
with reduce minimized the failing D43 corpus case to:
enum Event { Click | Key | Scroll }
global var seen: i32
fn partial(e: Event):
match e:
Key => seen = 5
On fix-globals stage1 (d7b800f0 plus the in-progress Never-call repair):
with-stage1 check repro.w --validate-all --no-prelude
error: validate-all failed: ownership MIR: fn sym7 stmt5 span=116: read of _2 reaches a path that never initialized it (Maybe)
The live compiler matrix records partial's Sema return type as 3 (i32), with MIR result locals of that same type. LLDB stops at Sema.check_match_expr, src/SemaCheck.w:16163:
The earlier missing-arm check has already classified this inferred tail as statement position, but only mixed written-arm types cause the final result to become Unit. With a single arm or same-typed arms, Sema retains i32; MIR consequently allocates a result and reads it even when no arm ran. This is a Sema decision and must be corrected there, not by adding a default result in MIR.
New behavior regression behav_d43_partial_match_tail_is_unit.w demands Unit from both single-statement and block-body spellings; all four bindings fail before the fix. test/phase/validate_partial_match_tail.w independently pins the validator verdict. Repair is in progress on fix-globals; no green gate or battery claimed yet.
Found during the #1883 validator sweep, part of the #1709 modeled-C close-out. Local evidence: out/handoff-partial-reduce.log, out/handoff-partial-lldb.log, out/handoff-partial-before.log, and out/handoff-partial-validator-before.log in that worktree.
Activity
Sema: a partial inferred match tail is Unit even when its written arm…