18883, "bmcdonald3", "Using require on a Chapel file only works if in the module with the main function", "2021-12-17T00:40:06Z"
Summary of Problem
Trying to require
a module in a Chapel file besides the file with the main()
function does not bring in the require
d file. It seems that putting a require
for a Chapel module in any included module should work as if it were in the main
module in the project hierarchy, as it does with non-Chapel module require
statements.
Steps to Reproduce
A.chpl
with main function
module A {
proc main() {
use B;
test();
}
}
B.chpl
with require (in same directory as A)
module B {
require '../C.chpl';
public use C;
}
C.chpl
with function to call (up one directory from modules A and B):
module C {
proc test() {
writeln("In module C");
}
}
And this is the error that you see compiling with chpl A.chpl
: error: Cannot find module or enum 'C'
Moving the require '../C.chpl'
to module A and the code compiles and runs as expected.