[
https://issues.apache.org/jira/browse/GROOVY-9630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17467013#comment-17467013
]
Paul King commented on GROOVY-9630:
-----------------------------------
Adding CST from groovyConsole (which confirms issue):
!image-2021-12-31-08-35-29-478.png!
> Parrot Parser: split declaration and initialization of "def var" sets
> incorrect modifier "var"
> ----------------------------------------------------------------------------------------------
>
> Key: GROOVY-9630
> URL: https://issues.apache.org/jira/browse/GROOVY-9630
> Project: Groovy
> Issue Type: Bug
> Components: parser-antlr4
> Affects Versions: 3.0.4
> Reporter: Eric Milles
> Priority: Minor
> Attachments: image-2020-07-08-16-07-22-846.png,
> image-2021-12-31-08-35-29-478.png
>
>
> Consider the following:
> {code}
> def var // optional comment
> var = 'initial value'
> {code}
> !image-2020-07-08-16-07-22-846.png!
> Parrot Parser sees first "var" as modifier and not variable declaration.
> Thus the split declaration and initialization is actually parsed like a
> declaration and initialization. IDE colors the modifiers differently from
> variable names and so "def" and first "var" get the same coloration.
> "def" can also be replaced by "final" and the same issue is observed.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)