Skip to content

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

Open
yush-1018 wants to merge 12 commits intoboa-dev:mainfrom
yush-1018:feat/joint-iteration-clean
Open

feat: implement Iterator.zip and Iterator.zipKeyed (#4564)#4946
yush-1018 wants to merge 12 commits intoboa-dev:mainfrom
yush-1018:feat/joint-iteration-clean

Conversation

@yush-1018
Copy link
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
Copy link

github-actions bot commented Mar 8, 2026

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
Copy link
Member

@nekevss nekevss left a comment

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
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
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
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
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
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
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
Contributor Author

Can you please review this once.

Thanks!

Copy link
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
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
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
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
Copy link

codecov bot commented Mar 18, 2026

Codecov Report

❌ Patch coverage is 82.05882% with 61 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.97%. Comparing base (6ddc2b4) to head (b1e8393).
⚠️ Report is 917 commits behind head on main.

Files with missing lines Patch % Lines
...gine/src/builtins/iterable/iterator_constructor.rs 73.61% 43 Missing ⚠️
core/engine/src/builtins/iterable/zip_iterator.rs 89.59% 18 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #4946       +/-   ##
===========================================
+ Coverage   47.24%   59.97%   +12.73%     
===========================================
  Files         476      583      +107     
  Lines       46892    63798    +16906     
===========================================
+ Hits        22154    38266    +16112     
- Misses      24738    25532      +794     

☔ View full report in Codecov by Sentry.
📢 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
Contributor Author

PR is ready to review.

Thanks!

@nekevss
Copy link
Member

nekevss commented Mar 21, 2026

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

@yush-1018 yush-1018 force-pushed the feat/joint-iteration-clean branch from 455af3a to 4f4cca1 Compare March 22, 2026 09:45
@yush-1018 yush-1018 force-pushed the feat/joint-iteration-clean branch from 4f4cca1 to b1e8393 Compare March 22, 2026 13:00
@github-actions
Copy link

Test262 conformance changes

Test result main count PR count difference
Total 52,963 52,963 0
Passed 50,545 50,545 0
Ignored 1,426 1,426 0
Failed 992 992 0
Panics 2 2 0
Conformance 95.43% 95.43% 0.00%

Tested main commit: 817b6eaade662a49434c5d295667068a4875b378
Tested PR commit: b1e8393b198609caf94b910fc92e53a6478f6874
Compare commits: 817b6ea...b1e8393

@yush-1018
Copy link
Contributor Author

PR is ready to merge.

Thanks!

@jedel1043
Copy link
Member

Marking as blocked on #5236, since that PR would remove a lot of the boilerplate code in this PR.

@jedel1043 jedel1043 added the Blocked Waiting for another code change label Mar 23, 2026
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 Blocked Waiting for another code change C-Builtins PRs and Issues related to builtins/intrinsics 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