[ https://issues.apache.org/jira/browse/GROOVY-10953?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King updated GROOVY-10953: ------------------------------- Description: The following code runs fine without {{TypeChecked}} but fails in static checking mode. {code} @groovy.transform.TypeChecked def method() { def (x, y, z) = 1..3 assert "$x $y $z" == '1 2 3' } method() {code} The error is: {noformat} [Static type checking] - Multiple assignments without list or tuple on the right-hand side are unsupported in static type checking mode {noformat} {code} The workaround is to replace the multi-assignment with: {code} def (x, y, z) = [1, 2, 3] {code} But since we know the range expression, we can do further checking. was: The following code runs fine without {{TypeChecked}} but fails in static checking mode. {code} @groovy.transform.TypeChecked def method() { def (x, y, z) = 1..3 assert "$x $y $z" == '1 2 3' } method() The error is: {noformat} [Static type checking] - Multiple assignments without list or tuple on the right-hand side are unsupported in static type checking mode {noformat} {code} The workaround is to replace the multi-assignment with: {code} def (x, y, z) = [1, 2, 3] {code} But since we know the range expression, we can do further checking. > Extend multi-assignment type checking to Range expressions > ---------------------------------------------------------- > > Key: GROOVY-10953 > URL: https://issues.apache.org/jira/browse/GROOVY-10953 > Project: Groovy > Issue Type: Improvement > Reporter: Paul King > Assignee: Paul King > Priority: Major > > The following code runs fine without {{TypeChecked}} but fails in static > checking mode. > {code} > @groovy.transform.TypeChecked > def method() { > def (x, y, z) = 1..3 > assert "$x $y $z" == '1 2 3' > } > method() > {code} > The error is: > {noformat} > [Static type checking] - Multiple assignments without list or tuple on the > right-hand side are unsupported in static type checking mode > {noformat} > {code} > The workaround is to replace the multi-assignment with: > {code} > def (x, y, z) = [1, 2, 3] > {code} > But since we know the range expression, we can do further checking. -- This message was sent by Atlassian Jira (v8.20.10#820010)