paulk-asert opened a new pull request, #3012:
URL: https://github.com/apache/groovy/pull/3012

   …t assignment, GEP-15 compound-assignment methods such as plusAssign) is not 
detected, while the equivalent method calls are
   
   Inside a @Pure method the checker refused a mutating call such as s.add(v) 
on a parameter or field but accepted the same mutation written as an operator, 
because it looked at a binary expression only to report a field or property 
reassignment.
   
   Operators that stand for a method call on their receiver are now checked as 
that call: a << b as leftShift (using the method type checking resolved), a[i] 
= v, a[i] op= v and a[i]++ / a[i]-- as putAt, and a compound assignment 
carrying COMPOUND_ASSIGN_TARGET as the recorded *Assign method, which covers 
every GEP-15 operator and extension implementations. @OperatorRename rewrites a 
renamed compound assignment into ScriptBytecodeAdapter.compoundAssign, so that 
form is recognised too. The receiver-type checks (logging, metrics, I/O, 
non-determinism, immutable types) are shared with named calls, so the allowed 
effects apply in the same way, and a @Pure callee is accepted.
   
   Only receivers outside the method's own state are checked: parameters, 
fields and properties, this, and variables captured by a checked closure. 
Building up a local value, the common idiom in pure code, is still accepted, as 
is a += v that only rebinds a because no *Assign method exists.
   
   Code that compiled before can now be refused, so this is intended for 6.1.0 
rather than a 6.0.x release.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to