wcc/ww: scopelookuptype prefers the current module's symbol
A type lookup in a bundled build resolved to the newest-installed same-leaf symbol from ANY module; prefer the current module first (mirror cstage sym.c:131; the prior attempt's failure was its own u64-vs-i32 guard bug, not a deeper layer — probe-proven). Also adds the rule-7 #58 notes at the latent varianterr/scruttype pair and rewrites the stale deferral block to closing cites. Report item [5].
This commit is contained in:
@@ -885,9 +885,11 @@ fn aliassym(c: *checker, n: *node) *sym = {
|
||||
// on the head-first bucket walk: e.g. utf8.invalid `!void`
|
||||
// vs strconv.invalid `!i32` resolves to whichever
|
||||
// registered first, driving localloadop MOVSXD/MOVQ
|
||||
// divergence at 994/995. Other bare-leaf callers in this
|
||||
// file (L1597 exprtype N_IDENT, L1795/L2720 N_DOT-callee
|
||||
// leaf, L600 varianterr, L647 scruttype) tracked as #55.
|
||||
// divergence at 994/995. The exprtype N_IDENT / N_DOT-callee
|
||||
// + exprtypeoftry / &fn-synth bare-leaf callers now all use
|
||||
// scopelookupprefer (the #56/#4/#11a wave). The only bare-leaf
|
||||
// type lookups left — varianterr (:1051) + scruttype (:1098) —
|
||||
// stay mod-blind but have no reproducible divergence; #58.
|
||||
s = scopelookupprefer(c.cur, c.curmod, nm);
|
||||
// #61 A.5: bare TNAME that collides with an imported
|
||||
// module bareword. Two shapes hit this:
|
||||
@@ -905,7 +907,13 @@ fn aliassym(c: *checker, n: *node) *sym = {
|
||||
// bare-vs-qualified pattern from task #57.
|
||||
if (s != nil) {
|
||||
if (s.skind != skind.SK_TYPE) {
|
||||
let sm: *sym = scopelookuptype(c.cur, nm);
|
||||
// #58/#50: prefer the curmod-matching SK_TYPE.
|
||||
// Two modules exporting the same type leaf (e.g.
|
||||
// utf8.invalid !void vs strconv.invalid !i32)
|
||||
// otherwise resolve install-order-dependent here
|
||||
// when a value binding shadows the leaf; cstage
|
||||
// passes c->cur_mod to scope_lookup_type (sym.c).
|
||||
let sm: *sym = scopelookuptype(c.cur, c.curmod, nm);
|
||||
if (sm != nil) { s = sm; };
|
||||
};
|
||||
};
|
||||
@@ -1042,6 +1050,10 @@ fn varianterr(c: *checker, v: *node) bool = {
|
||||
if (v == nil) { return false; };
|
||||
if (v.kind == nkind.N_TBANG) { return true; };
|
||||
if (v.kind == nkind.N_TNAME) {
|
||||
// #58: mod-blind by leaf — latent. A same-leaf error-vs-plain
|
||||
// type pair across two modules could in principle flip iserror,
|
||||
// but the union's variants resolve at its declaration before
|
||||
// varianterr runs, so no repro exists. Tracked: #58.
|
||||
let s: *sym = scopelookup(c.cur, v.str);
|
||||
if (s != nil) {
|
||||
if (s.skind == skind.SK_TYPE) {
|
||||
@@ -1089,6 +1101,10 @@ fn iserrvariant(c: *checker, tagged: *node, v: *node) bool = {
|
||||
fn scruttype(c: *checker, e: *node) *node = {
|
||||
if (e == nil) { return nil; };
|
||||
if (e.kind == nkind.N_IDENT) {
|
||||
// #58: mod-blind by leaf — lenient-only. Feeds match
|
||||
// exhaustiveness; codegen reads the stamped n.type_, so a
|
||||
// mis-resolution cannot drive a wrong binary (no repro).
|
||||
// Tracked: #58.
|
||||
let s: *sym = scopelookup(c.cur, e.str);
|
||||
if (s == nil) { return nil; };
|
||||
if (s.decl == nil) { return nil; };
|
||||
|
||||
Reference in New Issue
Block a user