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

Paul King edited comment on GROOVY-8131 at 3/26/17 5:32 AM:
------------------------------------------------------------

Currently, this is by design rather than a bug. Groovy treats the semicolon as 
a statement separator not statement terminator like in Java.

As another example, inside the collect below, there is an expression returning 
4 then an expression returning the result +3 (which is just 3) and for Groovy 
there is an implicit return of the last expression:
{code}
assert [3] == [1].collect {
  4
  + 3
}
{code}
Having said that, we do look ahead for closure left curly braces inside 
builders for instance. In theory we could enhance the grammar to handle 
additional cases like the equals but obviously not for all symbols (e.g. 
changing the '+' as per the above example would break existing code).


was (Author: paulk):
Currently, this is by design rather than a bug. Groovy treats the semicolon as 
a statement separator not statement terminator like in Java.

As another example, inside the collect below, there is an expression returning 
4 then an expression returning the result +3 (which is just 3) and for Groovy 
there is an implicit return of the last expression:
{code}
assert [3] == [1].collect {
  4
  + 3
}
{code}


> Statement continued onto next line is flagged when first character is "="
> -------------------------------------------------------------------------
>
>                 Key: GROOVY-8131
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8131
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.4.5
>         Environment: Ubuntu Linux
> `uname -a`:
> Linux biostar 4.4.0-69-generic #90-Ubuntu SMP Thu Mar 16 16:52:31 UTC 2017 
> x86_64 x86_64 x86_64 GNU/Linux
>            Reporter: Richard Elkins
>            Priority: Minor
>         Attachments: grbug.java
>
>
> Source code attached (grbug.java).
> `javac` v8 compiles variable declarations s1, s2, and s3 successfully.
> `groovyc` flags s3:
> "unexpected token: = @ line 9, column 3."



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to