Describe the bug
The Stratego 2 runtime bunches all definitions of a rule across different modules in one location, effectively removing the limited scope of rules within modules. The type-checker does respect module boundaries, so safe behavior according to the type-checker can result in unsafe behavior at run-time.
Project
Occurs when compiling and running Stratego 2.
Versions
See Spoofax (Meta); Report Issue for information to copy here.
No idea where to find this in Spoofax, looked for 15 minutes. Spoofax LWB 0.16.17.
To Reproduce
- Define three stratego files:
main.str2, A.str2, B.str2.
- Have
main import A and B, but do nothing else.
- Define a rule
rule in A and B.
- Use
rule in B.
Observed behaviour
The usage of rule in B will non-deterministically choose between the rule in A and B, even though A is not imported in B.
Note that the type-checker will not error here, even if the signatures of the two rules are incompatible, as it does respect module boundaries.
Expected behaviour
The usage of rule in B should always use the definition in B, as the definition of rule in A is not in scope.
Additional context
This problem causes completely unexpected behavior, which is not caught by the type-checker.
Describe the bug
The Stratego 2 runtime bunches all definitions of a rule across different modules in one location, effectively removing the limited scope of rules within modules. The type-checker does respect module boundaries, so safe behavior according to the type-checker can result in unsafe behavior at run-time.
Project
Occurs when compiling and running Stratego 2.
Versions
See Spoofax (Meta); Report Issue for information to copy here.
No idea where to find this in Spoofax, looked for 15 minutes. Spoofax LWB 0.16.17.
To Reproduce
main.str2,A.str2,B.str2.mainimportAandB, but do nothing else.ruleinAandB.ruleinB.Observed behaviour
The usage of
ruleinBwill non-deterministically choose between theruleinAandB, even thoughAis not imported inB.Note that the type-checker will not error here, even if the signatures of the two
rules are incompatible, as it does respect module boundaries.Expected behaviour
The usage of
ruleinBshould always use the definition inB, as the definition ofruleinAis not in scope.Additional context
This problem causes completely unexpected behavior, which is not caught by the type-checker.