You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2020/07/08 21:12:00 UTC

[jira] [Updated] (GROOVY-9630) Parrot Parser: split declaration and initialization of "def var" sets incorrect modifier "var"

     [ https://issues.apache.org/jira/browse/GROOVY-9630?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles updated GROOVY-9630:
--------------------------------
    Affects Version/s: 3.0.4

> 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
>
>
> 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.3.4#803005)