Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
The following code runs fine without TypeChecked but fails in static checking mode.
@groovy.transform.TypeChecked def method() { def (x, y, z) = 1..3 assert "$x $y $z" == '1 2 3' } method()
The error is:
[Static type checking] - Multiple assignments without list or tuple on the right-hand side are unsupported in static type checking mode
The workaround is to replace the range on the RHS of the multi-assignment with a list:
def (x, y, z) = [1, 2, 3]
But since we know the range expression, we can do further checking.
Attachments
Attachments
Issue Links
- is cloned by
-
GROOVY-10960 For multi-assignment type checking of Range expressions, consider reporting an error for cases which have a known size
- Open
- links to