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
fix(codegen): fix Option match tag inversion in decision tree (C4)
Option match arms were swapped — `Some` mapped to tag 1 and `None` to
tag 0, but construction uses `Some=0, None=1`. This caused silent
miscompilation in both AOT and eval paths, producing wrong results for
any `match` on `Option<T>`. Fixed in 3 locations: flatten.rs
(decision tree compilation), emit.rs (variant field lookup), and the
eval decision tree walker. Fixes 114 previously-failing spec tests.
**Root cause hypothesis:** The match codegen for monomorphized built-in generic types uses a different variant ordering than construction. The `?` operator avoids this because it uses a direct `icmp eq` rather than a `switch`.
64
64
65
-
-[] Reproduce with Journey 12's code — AOT returns 144 instead of 33
66
-
-[] Write targeted test: `Option<int>` construction + match, compare eval vs AOT
-[ ] All 12 journeys: `./scripts/dual-exec-verify.sh` — 0 mismatches
180
-
-[] No new regressions: `./test-all.sh` green
181
-
-[]`./clippy-all.sh` green
180
+
-[x] No new regressions: `./test-all.sh` green
181
+
-[x]`./clippy-all.sh` green
182
182
183
183
**Exit Criteria:** All 4 critical bugs fixed. `./scripts/dual-exec-verify.sh` runs all 12 journey programs through both eval and AOT, producing 0 mismatches. No test regressions.
0 commit comments