rascal icon indicating copy to clipboard operation
rascal copied to clipboard

Parse method is "already defined" due to non-terminal labels?

Open jurgenvinju opened this issue 3 years ago • 4 comments

I ran into this error because of a stupid copy-and-paste error: Statement -> _with: 'WITH' "(" {Shorthand shorthand ","}+ ")" Eol ignore StatementBlock body 'ENDWITH' This results in a cryptic "method Shorthand() is already defined" error. Of course the fix is easy: Statement -> _with: 'WITH' "(" {Shorthand ","}+ shorthands ")" Eol ignore StatementBlock body 'ENDWITH'

Originally posted by @PieterOlivier in https://github.com/usethesource/rascal/issues/901#issuecomment-1100820959

jurgenvinju avatar Apr 19 '22 07:04 jurgenvinju

I have some clarification questions before I can triage this bug. @PieterOlivier, did the following happen:

  1. You had {Shorthand shorthand ","}+ in your rule and that resulted "method already defined" compilation errors?
  2. You changed it to {Shorthand ","}+ shorthands and the bug dissappeared?

jurgenvinju avatar Apr 19 '22 07:04 jurgenvinju

  1. Yes
  2. Yes

PieterOlivier avatar Apr 19 '22 07:04 PieterOlivier

One more question, is there another rule that contains Shorthand shorthand as a symbol in the grammar? and if so, what does it look like?

jurgenvinju avatar Apr 19 '22 07:04 jurgenvinju

oeps. wrong issue number in commit.

jurgenvinju avatar Apr 19 '22 08:04 jurgenvinju