rascal icon indicating copy to clipboard operation
rascal copied to clipboard

ambiguous code ` l <- m.methodOverrides<to,from>[hashCodeMethod]`

Open jurgenvinju opened this issue 3 years ago • 4 comments

Describe the bug

Ambiguous code (internal error), l <- m.methodOverrides<to,from>[hashCodeMethod]
org.rascalmpl.interpreter.asserts.Ambiguous: Ambiguous code (internal error), l <- m.methodOverrides<to,from>[hashCodeMethod]
        at org.rascalmpl.parser.uptr.UPTRNodeFactory.buildAmbiguityNode(UPTRNodeFactory.java:76)
        at org.rascalmpl.parser.uptr.UPTRNodeFactory.createListAmbiguityNode(UPTRNodeFactory.java:93)
        at org.rascalmpl.parser.uptr.UPTRNodeFactory.createListAmbiguityNode(UPTRNodeFactory.java:23)
        at org.rascalmpl.parser.gtd.result.out.ListContainerNodeFlattener.convertToUPTR(ListContainerNodeFlattener.java:529)
        at org.rascalmpl.parser.gtd.result.out.DefaultNodeFlattener.convert(DefaultNodeFlattener.java:65)

It seems there is ambiguity at the level of the <- error when field projecten is at play. Could be more complex. See the above example.

jurgenvinju avatar Sep 20 '21 12:09 jurgenvinju

this alternative with brackets is not ambiguous:

[ info("overrides Object.hashCode()", l) | l <- (m.methodOverrides<to,from>)[hashCodeMethod]]

jurgenvinju avatar Sep 20 '21 12:09 jurgenvinju

Duplicate of #1381?

rodinaarssen avatar Sep 20 '21 12:09 rodinaarssen

Looks like the <- plays a role here too. So it could be same part of the grammar where priorities are missing or invalid? Not a strict duplicate, but it seems to be related to #1381. Thanks @rodinaarssen

jurgenvinju avatar Sep 20 '21 12:09 jurgenvinju

You are right. It seems that the subexpression m<t,f>[index] is only ambiguous within a certain context. Here, it is inside <-, in #1381 inside a function call.

rodinaarssen avatar Sep 20 '21 12:09 rodinaarssen