fix: allow lexical import shadowing

This commit is contained in:
2026-08-22 17:53:31 +09:00
parent 89f519d5cb
commit 6279d46652
19 changed files with 1420 additions and 270 deletions

View File

@@ -1,9 +1,8 @@
// neg_mlet — Hare tuple destructure `let (shadowmod, x) = pair();`
// where the first binder shadows the imported module. N_MLET wires
// check_module_shadow per-binder, so the rule fires at the first
// name; the second binder `x` is innocuous.
// Legacy neg_mlet, now a positive tuple-binding case. The selector use before
// the destructure belongs to the import; afterward shadowmod is the first
// tuple element. Builds and runs 42 + 1 + 2 = 45.
package paramshadowmod;
package main;
import shadowmod;
@@ -11,7 +10,8 @@ fn pair() (i64, i64) = {
return 1i64, 2i64;
};
export fn main() i32 = {
fn main() i32 = {
let anchor: i32 = shadowmod.say();
let (shadowmod, x) = pair();
return (shadowmod + x): i32;
return anchor + (shadowmod + x): i32;
};