19256, "mppf", "parent module variable visible from tertiary method without use/import", "2022-02-16T18:17:48Z"
This issue is about a case that I recently ran into where it looks like the rule from PR #15312 (using parent module variable requires use/import) does not seem to apply to methods. Consider chapel/test_nested_method.chpl at main · chapel-lang/chapel · GitHub :
module OuterModule {
var w = 1; // There's a semantic question about if this should be accessible
// through the foo method defined in main. If the answer to that
// is no, remove w and the use of w in foo.
class C {
var x = 2;
}
module M {
import OuterModule.C;
var y = 3;
proc main() {
var z = 4;
proc C.foo() {
writeln(w, x, y, z);
}
var c = new unmanaged C();
c.foo();
delete c;
}
}
}
The access of w
inside of C.foo
is inside of a submodule so should not be able to see var w
(unless the test is modified to add use/import).