Hi Marcin,

I think it makes sense, that it does not fail, as a +=1 returns 2 which by
Groovys asBoolean is true. I am more inclined to say that Groovy 2.x had a
bug, that was accepted as a compile error.

Just my two cents worth.

Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.


Den ons. 8. jan. 2020 kl. 12.16 skrev Marcin Zajączkowski <msz...@wp.pl>:

> Hi,
>
> 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:
>
> > def a = 1
> > assert a += 1 //passes
> > assert a == 2 //passes
>
> While it behaves consistently, I wonder if that change it was purposely
> (it was failing in Groovy 2) or the check should be enhanced:
>
> https://github.com/apache/groovy/commit/a17b9eb85835a5eaa306a893a0a8bcd51a49e299#diff-05fe8708ce3207739a2cb39a97426e8dR345
> ?
>
> Marcin
>
> --
> https://blog.solidsoft.info/ - Working code is not enough
>

Reply via email to