difference in semantics between interpreted and compiled-to-Java Stratego code
I found that the following piece of Stratego code works fine when it is run from the .ctree file and fails when it is compiled to Java:
signature
constructors
elem : String -> Xrules
fetch-elem(|name) = fetch(?x@elem(name)); !x
run-test:
t -> None()
with
test-suite(
!“test suite”,
apply-test(
!" when given one element, fetch-elem works as expected",
fetch-elem(|“fixedType”),
![elem("fixedType")],
!elem(“fixedType”)
);
apply-test(
!" when given two elements, fetch-elem works as expected",
fetch-elem(|“fixedType”),
![elem("category"), elem("fixedType")],
!elem(“fixedType”)
)
)The first test succeeds both in the .ctree and .jar cases, the second test succeeds in the .ctree case and fails in the .jar case (fetch-elem strategy fails).
Initially I thought it might have to do with string sharing, but the first test seems to exclude that.Tested with Spoofax 0.6.0.2.
Submitted by Tobi Vollebregt on 5 January 2011 at 11:28
Issue Log
Moved from Spoofax/326; see the comments there for an analysis of this problem.
Log in to post comments