check: stamp SK_TYPE value idents with the per-decl NAMED

A TYPE name used as a VALUE (an error-singleton `return too_long;`)
stamped the flattened BODY type, so structurally identical !void
singletons in one union were indistinguishable and flatvariantidxt
loud-rejected the ambiguity — the real cause of the lib/path wwstage
reject (the pinned #120/#29 global-slice-const blame was stale; that
family had drained). The N_IDENT arm resolves through a synthesized
TNAME (the #66 N_STRUCTLIT precedent); the module-qualified N_DOT twin
reads the sym's cached NAMED. Graduates the path M_WWREJECT pin (#142).
This commit is contained in:
2026-08-08 01:00:03 +09:00
parent 125f626697
commit c18005d833
4 changed files with 69 additions and 11 deletions

View File

@@ -117,14 +117,16 @@ static const struct ent ents[] = {
/* fixtureless modules, import-probe shape */
{ .probe = "package main;\nimport sort;\nfn main() i32 = { return 0; };\n",
.mode = M_ID, .sentinel = "package sort;", .moddir = "lib/sort" },
/* c2-stack path::buffer realignment: w6c compiles, w6c_ww rejects
* path's module-global slice consts (const dot/dotdot: []u8) = the
* #120/#29 acceptance divergence (module-level composite globals);
* + the #148 twin #151 (global []u8 by-value arg). Both → #125
* batch. cstage runtime is covered by 989_path_run. M_WWREJECT
* self-graduates: flips RED to M_ID the day wwstage accepts this. */
/* #142 graduated (the old #120/#29 global-slice-const blame was
* stale — that family drained earlier): path declares three
* structurally identical !void error singletons, and a VALUE use
* (`return too_long;`) stamped the flattened BODY type, so
* flatvariantidxt loud-rejected the ambiguity. The SK_TYPE value
* arms now stamp the per-decl NAMED (the #66 N_STRUCTLIT
* precedent). Runtime pin: r142_singleton_value_named. */
{ .probe = "package main;\nimport path;\nfn main() i32 = { return 0; };\n",
.mode = M_WWREJECT, .cite = "#120/#29", .sentinel = "package path;", .moddir = "lib/path" },
.mode = M_ID, .cite = "#142 graduated by the SK_TYPE NAMED value stamp",
.sentinel = "package path;", .moddir = "lib/path" },
{ .probe = "package main;\nimport endian;\nfn main() i32 = { return 0; };\n",
.mode = M_ID, .sentinel = "package endian;", .moddir = "lib/endian" },
{ .probe = "package main;\nimport net;\nfn main() i32 = { return 0; };\n",

View File

@@ -0,0 +1,23 @@
//ww:run-exit 42
// #142: a VALUE use of an error-singleton type name whose union has
// structurally identical siblings. The pre-fix wwstage stamped the
// flattened BODY type (!void), so flatvariantidxt could not pick a
// variant and loud-rejected; the per-decl NAMED stamp discriminates.
// Exit 42 proves the SECOND variant is selected, not the first.
package main;
type a = !void;
type b = !void;
type err = !(a | b);
fn f() err = {
return b;
};
fn main() i32 = {
match (f()) {
case a => { return 41; };
case b => { return 42; };
};
return 9;
};