fix: allow lexical import shadowing
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
// neg_forrange_tuple — `for (let (shadowmod, x) .. s)` tuple-
|
||||
// destructure range loop where the first binder shadows the
|
||||
// imported module. N_FORRANGE wires check_module_shadow per-name
|
||||
// on the tuple branch (n->list), so the rule fires at the for
|
||||
// header even though `x` is innocuous.
|
||||
// Legacy neg_forrange_tuple, now a positive tuple-range case. The import
|
||||
// initializes total; the loop's first tuple element is the closer shadowmod
|
||||
// binding. Builds and runs 42 + 1 + 2 = 45.
|
||||
|
||||
package paramshadowmod;
|
||||
package main;
|
||||
|
||||
import shadowmod;
|
||||
|
||||
export fn main() i32 = {
|
||||
fn main() i32 = {
|
||||
let buf: [2]i64;
|
||||
buf[0] = 1i64;
|
||||
buf[1] = 2i64;
|
||||
@@ -16,7 +14,7 @@ export fn main() i32 = {
|
||||
s.ptr = buf.ptr: *(i64, i64);
|
||||
s.len = 1;
|
||||
s.cap = 1;
|
||||
let total: i64 = 0i64;
|
||||
let total: i64 = shadowmod.say(): i64;
|
||||
for (let (shadowmod, x) .. s) {
|
||||
total += shadowmod + x;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user