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

Marcin Zajaczkowski commented on GROOVY-9360:
---------------------------------------------

[~emilles] Having no comment on closing this issue with "Not A Problem", I 
assume the behavior in Groovy 3 is ok and it is an expected to keep it in the 
future versions of Groovy, right?

> += and -= no longer rejected in assertion statement in Groovy 3
> ---------------------------------------------------------------
>
>                 Key: GROOVY-9360
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9360
>             Project: Groovy
>          Issue Type: Question
>          Components: parser-antlr4
>    Affects Versions: 3.0.0-rc-2
>            Reporter: Marcin Zajaczkowski
>            Priority: Minor
>
> Playing with the failures which Groovy 3 brought to Spock tests itself,
> I noticed that Groovy 3 no longer rejects += and -= if used in an
> assertion statement:
> {code:java}
> //Groovy 3-rc2
> def a = 1
> assert a += 1 //passes
> assert a == 2 //passes
> {code}
> While it behaves consistently, I wonder if that change was introduced 
> purposely (it was failing in Groovy 2) and should be documented or the check 
> should be enhanced?
> {code:java}
> //Groovy 2.5
> startup failed:
> Script1.groovy: 3: unexpected token: += @ line 1, column 10.
>    assert a += 1
>             ^1 error
> {code}
> [https://github.com/apache/groovy/commit/a17b9eb85835a5eaa306a893a0a8bcd51a49e299#diff-05fe8708ce3207739a2cb39a97426e8dR345]
> Follow up of the mailing list 
> [thread|https://mail-archives.apache.org/mod_mbox/groovy-dev/202001.mbox/%[email protected]%3e].



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

Reply via email to