w6c+selfhost: cross-module same-leaf type disambiguation via Sym.mod
This commit is contained in:
19
test/wcc/data/modcollision/neg.ww
Normal file
19
test/wcc/data/modcollision/neg.ww
Normal file
@@ -0,0 +1,19 @@
|
||||
// Negative case: declare `b: mod1.stream` then access a mod2-only
|
||||
// field. With the mod-tagged scope lookup `b` resolves to mod1.stream
|
||||
// (fields a, b), so the field access `b.c` must be a compile-time
|
||||
// error rather than silently binding to mod2.stream and succeeding.
|
||||
//
|
||||
// No cross-module call is made: a missing mod1.make would itself
|
||||
// trigger a link-time error that could mask the field-resolution
|
||||
// error this test is actually pinning. `let b: mod1.stream;` is
|
||||
// enough — we read b.c before initializing it, which is fine because
|
||||
// the field-resolution error fires at check, long before any reach
|
||||
// analysis or codegen runs.
|
||||
|
||||
use mod1;
|
||||
use mod2;
|
||||
|
||||
fn main() i32 = {
|
||||
let b: mod1.stream;
|
||||
return b.c; // mod1.stream has no `c`; expect a compile error.
|
||||
};
|
||||
Reference in New Issue
Block a user