wcc: dot-lhs prefers SK_USE module over same-leaf type/fn name
The wwstage checker resolved a module-qualified call/access mod.x by the same-module preference in scopelookupprefer, so when the importing package's name collides with a type/fn of the same leaf (package fnmatch with fn fnmatch; package random with type random), the dot-lhs mod resolved to the same-leaf SK_TYPE/SK_FN instead of the coexisting SK_USE import — the N_DOT module-qual arm never fired and the call went nil-stamped (the D class of the asserttyped gap audit: fnmatch 2, random 16). cstage resolves this via Sym.use_alias; this ports the equivalent to wwstage. Add scopelookupuselocal (a single-scope SK_USE lookup, twin of scopelookuptype) and prefer SK_USE for a dot-lhs in exprtype's N_CALL and N_DOT arms, keyed on the scope where scopelookupprefer landed so a local binding sharing a module's leaf keeps value semantics. Scope-layer only — no type-identity touch (cstage use_alias never reaches type_eq). Drives the 901 gap-corpus D count to 0 (random_test now byte-id cs==ww). Compiler binary unchanged (no such collision in its own source); 990-997 hold. The separate fnmatch bare-enum-member cgen cs!=ww is unrelated (filed).
This commit is contained in:
@@ -23,8 +23,8 @@
|
||||
* A module-qual N_DOT call result checked_test 0 (closed)
|
||||
* B fn-ptr struct-field call smoke 3
|
||||
* C abort intrinsic callee utf8 8
|
||||
* D module-leaf == type/fn name fnmatch 2
|
||||
* D module-leaf == type/fn name random 16
|
||||
* D module-leaf == type/fn name fnmatch 0 (closed)
|
||||
* D module-leaf == type/fn name random 0 (closed)
|
||||
*
|
||||
* Exit code of wwdump_ww is intentionally not gated: the diagnostics
|
||||
* land on stderr regardless of the run's success, and arming the bail
|
||||
@@ -113,9 +113,9 @@ main(void)
|
||||
{ "lib/encoding/utf8/utf8.combined.ww",
|
||||
"C abort intrinsic callee", 8 },
|
||||
{ "lib/fnmatch/fnmatchtest.combined.ww",
|
||||
"D module-leaf == type/fn name", 2 },
|
||||
"D module-leaf == type/fn name", 0 },
|
||||
{ "lib/math/random/random_test.combined.ww",
|
||||
"D module-leaf == type/fn name", 16 },
|
||||
"D module-leaf == type/fn name", 0 },
|
||||
{ NULL, NULL, 0 },
|
||||
};
|
||||
|
||||
@@ -151,6 +151,6 @@ main(void)
|
||||
return 1;
|
||||
}
|
||||
printf("asserttyped_gap: ww-stage checker warn set matches manifest "
|
||||
"on %d gap-corpus fixtures (B+C+D pinned, A closed)\n", n);
|
||||
"on %d gap-corpus fixtures (B+C pinned, A+D closed)\n", n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user