paulk-asert opened a new pull request, #3220: URL: https://github.com/apache/groovy/pull/3220
…t-hand side reads the wrong variable and has the wrong value Static compilation rewrites a multiple assignment whose right-hand side is a list literal into single assignments. For a declaration such as def (a, b) = [1, a], the second value then read the variable declared for the first one instead of the field or property "a", and the value of the rewritten expression was its last assignment instead of the list, so a multiple assignment used as a value, for example as the last statement of a closure, produced a wrong value or a GroovyCastException. Keep the rewrite only where the value of the multiple assignment is not used, that is for an expression statement that is not the implicit return value of a method or closure; elsewhere the list is evaluated and assigned from, as dynamic Groovy does. For a declaration whose later values name a variable declared for an earlier value, evaluate every value into a temporary before declaring the variables, as the rewrite already did for plain assignments. -- 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]
