Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.0.5
-
None
Description
If you try to assign multiple variables from an iterator Groovy will skip every other value.
Example:
final list = [1,2,3] final iter = list.iterator() final def (a,b,c) = list final def (d,e,f) = iter assert "$a $b $c" == "$d $e $f"
Result:
Assertion failed: assert "$a $b $c" == "$d $e $f" | | | | | | | 1 2 3 | 1 3 null false
The expected behavior is either that the assertion succeeds, or the assignment to (d,e,f) fails outright.
If this is fixed it would also be nice if any Iterable could be used on the RHS.
Attachments
Issue Links
- relates to
-
GROOVY-10666 Implement multiple-assignment (aka destructuring) via getAt(IntRange) or iterator()
- Closed
- links to