Wrong binding in interpreter
Innermost binds terms outside of its scope.
A sample application is probably more explanatory:
main = testVar := EntityNoSuper(None(), [Property("x", None(), None(), None())]) ; where(innermost(test-strategy)) ; debug(!"Result: ") ; <debug(!"Result2: ")> testVar test-strategy: Property(a,b,c,d) -> Prop(a,b,c,d,None())
Results in
Result: EntityNoSuper(None,[Prop("x",None,None,None,None)]) Result2: EntityNoSuper(None,[Prop("x",None,None,None,None)])
This happens only in the interpreter, the compiled (java) version works fine.
Submitted by Nathan Bruning on 8 April 2010 at 20:42
Issue Log
I guess the problem boils down to org.spoofax.interpreter.stratego.All, which performs an in-place update on line 74.
Note that this bug also effectively nullifies the usage of origin-track-forced.
You’re right, the problem does seem to be in All.java. However, it doesn’t change lists in place it in place: it first creates an array copy of them, and changes the array in place. For StrategoAppls, however, the implementation assumes that getAllSubterms() creates a defensive copy of the term arguments. This is no longer the case with the new StrategoTerm library. I changed the implementation of All.java accordingly.
(For performance, it would be better to use the strategy of SRTS_all.java to implement ‘all’ in the future, which doesn’t rely so much on copying terms.)
Fixed in r20756.
Log in to post comments