fix: allow lexical import shadowing
This commit is contained in:
@@ -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");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user