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,8 +1,8 @@
// neg_param — fn param `shadowmod: str` shadows the imported module.
// Under the "value names and module names are disjoint" rule the
// build must fail with a clear diagnostic at the param decl site.
// Legacy neg_param, now a positive lexical-scope case. The package selector
// in main uses the file-scope import; the parameter named shadowmod is a
// closer binding only inside probe. Builds and runs 42 + len("hi") = 44.
package paramshadowmod;
package main;
import shadowmod;
@@ -10,6 +10,6 @@ fn probe(shadowmod: str) i32 = {
return shadowmod.len;
};
export fn main() i32 = {
return probe("hi");
fn main() i32 = {
return shadowmod.say() + probe("hi");
};