|
|
|
The transformation "x.bar = 2; return x.bar" is incorrect.¹ Instead it should be "return (x.bar = 2)", which would solve this issue.
¹ It's even more likely to have unwanted side-effects when a method is involved, for example in "x.bar().foo = 2". This was fixed with
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
imagine:
def foo() {
x
}
x is returned here
your example is put into a method by groovy. This means x.bar=2 is transformed into:
x.bar=2
return x.bar
so it's no wonder that you will get this error message