[
https://issues.apache.org/jira/browse/GROOVY-5744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17615180#comment-17615180
]
ASF GitHub Bot commented on GROOVY-5744:
----------------------------------------
eric-milles commented on PR #1756:
URL: https://github.com/apache/groovy/pull/1756#issuecomment-1273516380
@paulk-asert Instead of revert, can you just replace the "multiple
declaration or assignment" block? There are some other fixups, including new
test cases that I'd like to keep.
> Multiple assignment from Iterator skips every other element
> -----------------------------------------------------------
>
> Key: GROOVY-5744
> URL: https://issues.apache.org/jira/browse/GROOVY-5744
> Project: Groovy
> Issue Type: Bug
> Components: groovy-runtime
> Affects Versions: 2.0.5
> Reporter: Justin Piper
> Assignee: Eric Milles
> Priority: Minor
> Fix For: 5.0.0-alpha-1
>
>
> If you try to assign multiple variables from an iterator Groovy will skip
> every other value.
> Example:
> {code}
> 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"
> {code}
> Result:
> {noformat}
> Assertion failed:
> assert "$a $b $c" == "$d $e $f"
> | | | | | | |
> 1 2 3 | 1 3 null
> false
> {noformat}
> 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.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)