wcc: enums compare nominally; folded members keep their enum stamp

Two composing defects made a two-enum union mis-tag in wwstage
(live cs!=ww: `let e: (color|shape) = shape.BALL` stored tag 0 —
the color arm — while cstage stored 1). type_eq/typeeq had no
TY_ENUM arm, so ANY two enums fell into the primitive default and
compared equal; enums are nominal (harec: an enum IS its alias
type) and now compare by node identity only. Underneath, the
wwstage post-order revisit re-stamped the constant-folded enum
member (an N_INTLIT) as untyped_int, clobbering the enum stamp the
N_DOT fold applied, so the widen matcher fell to its first-variant
fallback -- the #59.9 N_BIN guard now twins on N_INTLIT (cstage
cexpr is single-pass and never clobbered).
This commit is contained in:
2026-08-09 01:26:31 +09:00
parent 4a5f64fc3d
commit cf9d83b209
5 changed files with 56 additions and 4 deletions

View File

@@ -1,13 +1,13 @@
package wwfixture;
def protocolversion: i32 = 1;
def corpuscount: i32 = 1751;
def corpuscount: i32 = 1752;
def errorcount: i32 = 349;
def compilecount: i32 = 21;
def runcount: i32 = 209;
def runexitcount: i32 = 1172;
def nativecount: i32 = 3502;
def corpushash: str = "0d0401f0d80ca682b0872343a62db4f91c0ff4c68e71f97cd5358cf92faffebc";
def runexitcount: i32 = 1173;
def nativecount: i32 = 3504;
def corpushash: str = "d3c7b6a94918a9c9af14df029ef0cdf6d976a3f1351d41ff9db9a69b753cb016";
type directive = enum i32 {
ERROR = 0,