Skip to content

feat: implement Iterator.zip and Iterator.zipKeyed (#4564) - #4946

Merged
jedel1043 merged 30 commits into
boa-dev:mainfrom
yush-1018:feat/joint-iteration-clean
Aug 31, 2026
Merged

feat: implement Iterator.zip and Iterator.zipKeyed (#4564)#4946
jedel1043 merged 30 commits into
boa-dev:mainfrom
yush-1018:feat/joint-iteration-clean

Conversation

@yush-1018

Copy link
Copy Markdown
Contributor

Implements the TC39 Joint Iteration proposal (#4564).

Adds Iterator.zip and Iterator.zipKeyed static methods with support for
"shortest", "longest", and "strict" modes. Includes a new ZipIterator
backing object with proper iterator protocol handling.

@yush-1018
yush-1018 requested a review from a team as a code owner March 8, 2026 07:47
@github-actions

github-actions Bot commented Mar 8, 2026

Copy link
Copy Markdown

Test262 conformance changes

Test result main count PR count difference
Total 52,963 52,963 0
Passed 50,073 50,073 0
Ignored 2,072 2,072 0
Failed 818 818 0
Panics 0 0 0
Conformance 94.54% 94.54% 0.00%

Tested main commit: 055ee0958ce332f3f99af27536a7c6f9a91def27
Tested PR commit: 455af3a0d140f320fa6877fb11aa665825857998
Compare commits: 055ee09...455af3a

@jedel1043 jedel1043 added the C-Builtins PRs and Issues related to builtins/intrinsics label Mar 8, 2026
nekevss
nekevss previously requested changes Mar 8, 2026

@nekevss nekevss left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please look at some other built-in for general style on implementation.

Most steps should have some level of documentation. There's a lot of nesting here and it's not clear whether it's a result of the specification or can be improved in another way.

let iterables = args.get_or_undefined(0);
let options = args.get_or_undefined(1);

// 1. If iterables is not an Object, throw a TypeError exception.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: include the entire specification text.

let mode = Self::parse_zip_mode(options, context)?;

// 6-7. Parse padding option (only for "longest" mode).
let padding_option = if mode == ZipMode::Longest {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: rewrite these using some if-let chains

let mode = Self::parse_zip_mode(options, context)?;

// 6-7. Parse padding option.
let padding_option = if mode == ZipMode::Longest {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: use if-let chains here

}
}

impl IntrinsicObject for ZipIterator {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move this higher up in the file

@yush-1018

Copy link
Copy Markdown
Contributor Author

Hey @nekevss,

All review feedback addressed! (Added spec comments, refactored padding parsing with if let, and moved the IntrinsicObject impl).

Ready for review.

Thanks!

@jedel1043

Copy link
Copy Markdown
Member

All the implementation needs to be gated behind the experimental feature, since the proposal hasn't reached stage 4

@jedel1043 jedel1043 added A-Enhancement New feature or request Waiting On Author Waiting on PR changes from the author labels Mar 13, 2026
@github-actions github-actions Bot added the Waiting On Review Waiting on reviews from the maintainers label Mar 17, 2026
@yush-1018
yush-1018 marked this pull request as draft March 17, 2026 09:01
@yush-1018
yush-1018 force-pushed the feat/joint-iteration-clean branch from 99be867 to cc4de18 Compare March 17, 2026 17:59
@github-actions github-actions Bot added the C-Tests Issues and PRs related to the tests. label Mar 18, 2026
@yush-1018
yush-1018 marked this pull request as ready for review March 18, 2026 13:04
@yush-1018

Copy link
Copy Markdown
Contributor Author

Can you please review this once.

Thanks!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated change

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also unrelated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated...

@jedel1043

Copy link
Copy Markdown
Member

Also you didn't address some of Kevin's comments

@jedel1043 jedel1043 removed the Waiting On Review Waiting on reviews from the maintainers label Mar 18, 2026
@yush-1018
yush-1018 force-pushed the feat/joint-iteration-clean branch from 2612098 to 0993de3 Compare March 18, 2026 21:11
@codecov

codecov Bot commented Mar 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 2.94118% with 132 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.42%. Comparing base (6ddc2b4) to head (4e76aa8).
⚠️ Report is 1042 commits behind head on main.

Files with missing lines Patch % Lines
...gine/src/builtins/iterable/iterator_constructor.rs 3.60% 107 Missing ⚠️
core/engine/src/builtins/iterable/mod.rs 0.00% 25 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #4946       +/-   ##
===========================================
+ Coverage   47.24%   62.42%   +15.18%     
===========================================
  Files         476      534       +58     
  Lines       46892    59745    +12853     
===========================================
+ Hits        22154    37296    +15142     
+ Misses      24738    22449     -2289     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yush-1018

Copy link
Copy Markdown
Contributor Author

PR is ready to review.

Thanks!

@nekevss

nekevss commented Mar 21, 2026

Copy link
Copy Markdown
Member

Looks like there may be some conflicts that need to be resolved

@yush-1018
yush-1018 marked this pull request as ready for review April 9, 2026 05:56
@yush-1018

Copy link
Copy Markdown
Contributor Author

@jedel1043 ,

Please review the PR.

@jedel1043 jedel1043 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a lot of unnecessary files like cargo_error or check_output. You should remove those.

@yush-1018
yush-1018 marked this pull request as draft April 20, 2026 05:02
@yush-1018

Copy link
Copy Markdown
Contributor Author

@jedel1043,

can u please review this PR.

@yush-1018
yush-1018 marked this pull request as ready for review May 12, 2026 04:40
@yush-1018

Copy link
Copy Markdown
Contributor Author

@nekevss, PR is ready to merge plz take a review.

@jedel1043 jedel1043 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to tweak and refactor a chunk of the implementation to put it closer to the rest of the iterator helpers, but looks good now.

@jedel1043
jedel1043 dismissed nekevss’s stale review August 31, 2026 06:55

Changes should have been addressed, and I want to merge this asap to fix the bugs

@jedel1043
jedel1043 enabled auto-merge August 31, 2026 06:55
@jedel1043
jedel1043 added this pull request to the merge queue Aug 31, 2026
Merged via the queue into boa-dev:main with commit 10ef235 Aug 31, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Enhancement New feature or request C-Builtins PRs and Issues related to builtins/intrinsics C-Javascript Pull requests that update Javascript code C-Tests Issues and PRs related to the tests. Waiting On Author Waiting on PR changes from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants