w6c+selfhost: cross-module same-leaf type disambiguation via Sym.mod

This commit is contained in:
2026-05-15 10:26:20 +09:00
parent e349536f62
commit 66d6408cbe
15 changed files with 614 additions and 60 deletions

View File

@@ -0,0 +1,18 @@
// Positive case: two modules each export `type stream`. The consumer
// imports both and disambiguates via the module qualifier. mod1.stream
// has fields (a, b); mod2.stream has fields (c, d). The exit code
// encodes a sum of all four fields, so any cross-binding would either
// fail to compile or return the wrong value.
use mod1;
use mod2;
fn main() i32 = {
let s1: mod1.stream;
s1.a = 3: i32;
s1.b = 5: i32;
let s2: mod2.stream;
s2.c = 7: i32;
s2.d = 11: i32;
return s1.a + s1.b + s2.c + s2.d;
};