cgmatch's non-nullable variant-tag synthesis gated flatvariantidx on pat.kind == N_TNAME (with N_TSLICE else-branch for #19's untyped-elem fallback). N_TPTR / N_TFN / N_TPTR(N_TFN) case-patterns fell through both, leaving r=-1 → want=0 so every variant past 0 silently collapsed to tag 0 — runtime-passes only when the value happens to sit on variant 0 (zero-coincidence miscompile). Cstage cg_tag_for_variant works on resolved Type and is kind- agnostic; harec stores `_case->type = ctype` (ref/harec check.c:2527). #66 Phase-N already flipped match dispatch to typeeq; #179 is the last site still keyed on AST kind. Memory: project_tinfo_lossy_nominal + feedback "Hare = resolved-type-only match dispatch". Route through flatvariantidxt(scrutt.type_, pat.type_) directly, guarded by istaggedtype + typeisslice(pattype) for the slice axis. No new helper — existing flatvariantidxt / flatslicevariantidx wire up unchanged. 767 probe locks the fix across 5 rows: (1) nullable *fn branched store (ken's verify gate — proves the nullable arm at line 1484 isn't perturbed); (2) *i32|*i64 storing &i64 — pre-fix wwstage emitted CMPQ $0 for *i64 arm, post-fix CMPQ $1; (3) *fn(i32)|*fn(i64) via intermediate local; (4) branched runtime variant choice defeats const-fold; (5) aliased ptr variants (typeeq through TY_NAMED). Per row: cs runtime, ww runtime, cs.s == ww.s byte-id. Sibling filed inline: widening `&fn` INLINE into a fn-ptr-only tagged union picks tag 0 in wwstage's cgwidentaggedstorebp (out-of-scope; row 3 dodges via intermediate ident store).
56 KiB
56 KiB