We had a case where someone wrote a Stratego rule that has a wildcard in a build pattern:

  foo:
    bar -> _

The IDE produces an error, but this error is hidden behind the red cross on line 1. Specifically, the error does not show up on the wildcard term itself such that the error easily goes unnoticed. If you build the project the error does not show up. However, subsequent loading the language fails because the .ctree cannot be loaded (with an org.spoofax.interpreter.core.InterpreterException: Unknown op 'SRule/1').

tl;dr: Buliding a wildcard is an error but the build succeeds nevertheless resulting in errors that are confusing to Stratego/Spoofax newcomers.

Submitted by Martijn on 24 May 2018 at 09:16

On 24 May 2018 at 09:31 Jeff Smits tagged !jeffsmits

On 24 May 2018 at 14:47 Jeff Smits tagged error

On 24 May 2018 at 15:07 Jeff Smits commented:

Looks like there are two issues here: one is a problem in the Stratego editor with displaying the error upon building a wildcard, the second is that the compiler frontend doesn’t handle building a wildcard when it is in the build position of a rule.
I’ve checked and the second problem has to do with the desugaring in the frontend. It’s too strict, doesn’t desugar a rule such as in the example to strategy format, and therefore the check on building wildcards doesn’t fire to give an error. When you compile to Java or try to interpret the ctree you’ll run into issues of an undesugared SRule. Possible fix would be less strict desugaring, but first we need to find out if anything depends on partial desugaring of rules to strategies.
The first problem still needs to be looked into entirely.

Log in to post comments