20 lines
771 B
Plaintext
20 lines
771 B
Plaintext
// 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.
|
|
};
|