[ 
https://issues.apache.org/jira/browse/GROOVY-10724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17827328#comment-17827328
 ] 

Paul King commented on GROOVY-10724:
------------------------------------

The statements affected include:
{code}
(a) in []
(a) as Integer
(a) +4 // unary plus
(a) -4 // unary minus
{code}
All other statements are parsed correctly as far as I can tell. A workaround as 
mentioned in  GROOVY-11320 is to remove or double the parentheses.


> Parrot parser incorrectly treats an expression wrapped in parentheses as a 
> cast
> -------------------------------------------------------------------------------
>
>                 Key: GROOVY-10724
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10724
>             Project: Groovy
>          Issue Type: Bug
>          Components: parser-antlr4
>    Affects Versions: 3.0.12
>            Reporter: Marcin Erdmann
>            Priority: Major
>
> Trying to compile this code:
> {code:java}
> def a = ""
> (a) in []
> {code}
> results in
> {code:java}
> /path/to/file/Foo.groovy: 10: unable to resolve class a
>  @ line 21, column 9.
>            (a) in []
>            ^
> 1 error
> {code}
> Obviously the parentheses are not necessary and the problem goes away if you 
> drop them but it would be good if that code was still allowed like it was in 
> 2.5 or if at least the error wasn't so confusing.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to