Exception when matching on tuples
hendrikvanantwerpen opened this issue · 1 comments
hendrikvanantwerpen commented
Given the the following rule:
NaBL2 NaBL2(_,NR(entries),_) |- o:Occurrence -pathOf-> p
where entries[o] => (_,p).
The following exception occurs:
Caused by: org.spoofax.terms.util.NotImplementedException: Unsupported literal: Tuple([Wld,VarRef("p")])
at org.metaborg.meta.lang.dynsem.interpreter.nodes.matching.LiteralMatchPattern.create(LiteralMatchPattern.java:35)
at org.metaborg.meta.lang.dynsem.interpreter.nodes.matching.MatchPattern.create(MatchPattern.java:59)
at org.metaborg.meta.lang.dynsem.interpreter.nodes.rules.premises.MatchPremise.create(MatchPremise.java:43)
at org.metaborg.meta.lang.dynsem.interpreter.nodes.rules.premises.Premise.create(Premise.java:37)
at org.metaborg.meta.lang.dynsem.interpreter.nodes.rules.Rule.create(Rule.java:77)
at org.metaborg.meta.lang.dynsem.interpreter.nodes.rules.Rule.create(Rule.java:64)
at org.metaborg.meta.lang.dynsem.interpreter.nodes.rules.RuleRegistry.populate(RuleRegistry.java:94)
at org.metaborg.lang.pcf.interpreter.generated.PCFLanguage.parse(PCFLanguage.java:31)
at com.oracle.truffle.api.TruffleLanguage$LanguageImpl.eval(TruffleLanguage.java:574)
at com.oracle.truffle.api.vm.PolyglotEngine.evalImpl(PolyglotEngine.java:565)
at com.oracle.truffle.api.vm.PolyglotEngine.eval(PolyglotEngine.java:532)
at com.oracle.truffle.api.vm.PolyglotEngine.eval(PolyglotEngine.java:469)
at org.metaborg.meta.lang.dynsem.interpreter.DynSemEntryPoint.getCallable(DynSemEntryPoint.java:62)
at org.metaborg.meta.lang.dynsem.interpreter.DynSemRunner.run(DynSemRunner.java:144)
... 1 more
The same behaviour happened when matching on a tuple in the RO components.
vvergu commented
You can work around this bug by making sure the tuple match pattern does not have wildcards. You can ensure this by reading each of the variables at least twice (if variables are only read once they might be inlined in some cases).