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_mcase — `match (r) { case let shadowmod: i64 => ... }` where
// the per-arm binder shadows the imported module. N_MCASE wires
// check_module_shadow before scope_define on cs->str, so the rule
// fires at the case line.
// Legacy neg_mcase, now a positive match-arm case. The import supplies the
// tagged value before the arm binder exists; inside that arm shadowmod is the
// closer i64 binding. Builds and runs 42.
package paramshadowmod;
package main;
import shadowmod;
@@ -14,8 +13,8 @@ fn parse(n: i64) (i64 | i32) = {
return n;
};
export fn main() i32 = {
let r: (i64 | i32) = parse(42i64);
fn main() i32 = {
let r: (i64 | i32) = parse(shadowmod.say(): i64);
let out: i64 = 0i64;
match (r) {
case let shadowmod: i64 => out = shadowmod;