rascal
rascal copied to clipboard
`uses` field of `TModel` does not contain use
Describe the bug
The TModel has a list of uses and a use-def relation. Despite entries existing in the relation, the uses field is empty.
To Reproduce
import lang::rascalcore::check::Checker;
import IO;
import util::Reflective;
void main() {
A = "
'module A
'int f(int i) {
' int x = 2;
' return i * x;
'}
'void main() { f(); }
";
projLoc = |memory://tests/tmodels|;
pcfg = pathConfig(srcs = [projLoc + "rascal"], resources = projLoc + "target");
writeFile(pcfg.srcs[0] + "A.rsc", A);
ccfg = rascalCompilerConfig(pcfg);
ms = rascalTModelForNames(["A"], ccfg, dummy_compile1);
<found, tm, ms> = getTModelForModule("A", ms);
if (!found) throw "No TModel! <ms.messages>";
print("tm.useDef: ");
iprintln(tm.useDef);
print("tm.uses: ");
iprintln(tm.uses);
}
Running this:
rascal>main()
tm.useDef: {
<|memory://tests/tmodels/rascal/A.rsc|(78,1,<7,14>,<7,15>),|memory://tests/tmodels/rascal/A.rsc|(12,50,<3,0>,<6,1>)>,
<|memory://tests/tmodels/rascal/A.rsc|(53,1,<5,10>,<5,11>),|memory://tests/tmodels/rascal/A.rsc|(22,1,<3,10>,<3,11>)>,
<|memory://tests/tmodels/rascal/A.rsc|(57,1,<5,14>,<5,15>),|memory://tests/tmodels/rascal/A.rsc|(35,1,<4,7>,<4,8>)>
}
tm.uses: []
ok
Expected behavior
I would expect the list of uses to contain 3 unique Use entries.
Desktop (please complete the following information):
- Rascal Version:
0.41.0-RC10/ Rascal Core:0.12.16