Files
ww/test/wcc/data/samemodprefer/mod1/mod1.ww

19 lines
757 B
Plaintext

// samemodprefer/mod1 — exports a `read` that takes an i32 plus a
// `caller` that invokes bare `read(1i32)`. The bare-leaf lookup must
// resolve to mod1.read (i32 → i32) rather than mod2.read (str → i32),
// which coexists in the flat scope. Pre-fix the lookup picked
// whichever entry hashed earliest into the bucket; a wrong bind would
// surface as a check-time signature mismatch. Paired with mod2/mod2.ww
// and test/wcc/697_samemod_prefer.c.
export fn read(x: i32) i32 = {
return x + 100i32;
};
export fn caller() i32 = {
// Bare-leaf call inside mod1: must bind to mod1.read (i32 arg).
// If preference doesn't kick in this fails check: mod2.read
// expects a str, so `read(1i32)` would be a signature mismatch.
return read(1i32);
};