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,15 +1,14 @@
// neg_forrange_single — `for (let shadowmod .. s)` single-binding
// range loop where the loop variable shadows the imported module.
// N_FORRANGE wires check_module_shadow on the single-name branch
// (n->str), so the rule fires at the for header.
// Legacy neg_forrange_single, now a positive range-binding case. The import
// initializes total; the one-byte "A" iteration binds the closer shadowmod
// value in the loop body. Builds and runs 42 + 65 = 107.
package paramshadowmod;
package main;
import shadowmod;
export fn main() i32 = {
let s: str = "abc";
let total: i32 = 0i32;
fn main() i32 = {
let s: str = "A";
let total: i32 = shadowmod.say();
for (let shadowmod .. s) {
total += shadowmod: i32;
};