19 lines
761 B
Plaintext
19 lines
761 B
Plaintext
// samemodprefer/mod2 — exports a `read` that takes a str plus a
|
|
// `caller` that invokes bare `read("ok")`. The bare-leaf lookup must
|
|
// resolve to mod2.read (str → i32) rather than mod1.read (i32 → 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 mod1/mod1.ww
|
|
// and test/wcc/697_samemod_prefer.c.
|
|
|
|
export fn read(x: str) i32 = {
|
|
return x.len + 200i32;
|
|
};
|
|
|
|
export fn caller() i32 = {
|
|
// Bare-leaf call inside mod2: must bind to mod2.read (str arg).
|
|
// If preference doesn't kick in this fails check: mod1.read
|
|
// expects an i32, so `read("ok")` would be a signature mismatch.
|
|
return read("ok");
|
|
};
|