I discussed this with Martin Bravenboer and Lennart Kats and they both have no idea how this scan happen. I tried to minimalize the example and this is how far I got (see attachment). Essentially, the problem showed itself when I was doing a topdown traversal, as such:

c := <topdown(try(remove-unnecessary-annos))> tmp

This in itself is successful (of course), but breaks something internally I suspect (maybe in the ATerm?). Here is the complete rule:

merge-classes :
lst -> c
where tmp := lst
; c := <topdown(try(remove-unnecessary-annos))> tmp
; debug(!"Output: ")

which is called from main:

main =
cu1 := FILE(“Class1.java”)
; cu2 := FILE(“Class2.java”)
; cu3 := FILE(“Class2.java”)
; [cu1, cu2, cu3]
; debug(!“Another”)

Now the odd thing is that it does show the "Output: " debug message, but gives a “rewrite failed” message before it gets to the debug(!“Another”) line. Which, of course should never happen. I put some pointers in the attached code about what you can do to reproduce the problem and how to fix it.

Submitted on 9 January 2008 at 13:57

On 9 January 2008 at 14:55 Jira commented:

STR-731, lennartkats:
It looks like there’s a logical bug in the submitted program:
merge-many-classes : [a|[b|k]] -> (a, [b|k])
should be:
merge-many-classes : [a|[b|k]] -> (a, [b|k])

I discussed this with Zef, and we’re not sure if this is the actual root cause of the problem as it occurred in the first place. But although at least one of our debugging trials seemed to indicate otherwise, it does at least explain the observed behavior of the program of this example program. Therefore, unless Zef finds another example, I propose to close this issue.


On 9 January 2008 at 15:18 Jira commented:

STR-731, zef:
Even though there’s this logical bug in the program, that does not mean there’s no bug in Stratego. Even programs with logical bugs should have explainable behavior do they not?


On 9 January 2008 at 16:06 Jira commented:

STR-731, lennartkats:
Well, for this program there’s a perfectly logical explanation: merge-classes calls merge-many-classes, which again calls merge-classes. At that point, message "output: " is printed. After that, the program fails in merge-many-classes, unable to merge the annotation-stripped classes.


On 9 January 2008 at 16:16 Jira commented:

STR-731, zef:
Oh yes, that is a good point. Hmm.


On 9 January 2008 at 19:15 Jira commented:

STR-731, martin:
Right, I don’t think there is a reason to keep this issue open.

Log in to post comments