Root cause
When array destructuring exhausts the iterator early (e.g., via a rest element or because fewer elements are consumed than exist), the iterator's return() method must be called to signal early close. The engine does not call return() in all required cases.
Additional sub-cluster: when return() itself throws, the exception must propagate correctly.
Failure breakdown — language/expressions suite (2026-06-21)
All 6 unique failing tests are in assignment/dstr/:
array-elem-iter-rtrn-close.js — return() not called after partial consume
array-rest-iter-rtrn-close.js — return() not called after rest collect
array-elem-iter-rtrn-close-err.js — return() throws, exception not propagated
array-rest-iter-rtrn-close-err.js — same for rest
array-elem-iter-rtrn-close-null.js — return() returns null, should not throw
array-rest-iter-rtrn-close-null.js — same for rest
Fix direction
IteratorClose (§7.4.9) must be called in ArrayAssignmentPattern evaluation after the binding list is complete if the iterator is not already done. Verify both the normal path and the abrupt completion path.
Root cause
When array destructuring exhausts the iterator early (e.g., via a rest element or because fewer elements are consumed than exist), the iterator's
return()method must be called to signal early close. The engine does not callreturn()in all required cases.Additional sub-cluster: when
return()itself throws, the exception must propagate correctly.Failure breakdown — language/expressions suite (2026-06-21)
All 6 unique failing tests are in
assignment/dstr/:array-elem-iter-rtrn-close.js— return() not called after partial consumearray-rest-iter-rtrn-close.js— return() not called after rest collectarray-elem-iter-rtrn-close-err.js— return() throws, exception not propagatedarray-rest-iter-rtrn-close-err.js— same for restarray-elem-iter-rtrn-close-null.js— return() returns null, should not throwarray-rest-iter-rtrn-close-null.js— same for restFix direction
IteratorClose(§7.4.9) must be called inArrayAssignmentPatternevaluation after the binding list is complete if the iterator is not already done. Verify both the normal path and the abrupt completion path.