Skip to content

Ensure syntactic ordering when visiting array-type AST nodes#17357

Merged
JLHwung merged 4 commits intobabel:mainfrom
JLHwung:fix-17339
Jun 5, 2025
Merged

Ensure syntactic ordering when visiting array-type AST nodes#17357
JLHwung merged 4 commits intobabel:mainfrom
JLHwung:fix-17339

Conversation

@JLHwung
Copy link
Copy Markdown
Contributor

@JLHwung JLHwung commented Jun 2, 2025

Q                       A
Fixed Issues? Fixes #17339
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

In #16710 we ensured the visitor keys ordering for most AST nodes. However, the previous tests overlooked the array type AST nodes, the start position check never kicked in because we are comparing two undefined. The issue now surfaces thanks to #17339.

In this PR we expand the check such that it works for both array and object types. Then we fixed the reported incorrect ordering. We also added a new object pattern test for the legacy decorator since they were previously not covered by any parser tests.

@JLHwung JLHwung added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Jun 2, 2025
@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Jun 2, 2025

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/59518

@JLHwung JLHwung merged commit 781e23e into babel:main Jun 5, 2025
68 of 69 checks passed
@JLHwung JLHwung deleted the fix-17339 branch June 5, 2025 00:15
@github-actions github-actions Bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Sep 24, 2025
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: @babel/generator generate wrong code in some function call expressions using generics with experimental_preserveFormat: true

4 participants