Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Class decorator correctly passes return value #16199

Merged
merged 2 commits into from Jan 3, 2024

Conversation

liuxingbaoyu
Copy link
Member

@liuxingbaoyu liuxingbaoyu commented Dec 30, 2023

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

Edit by @JLHwung

In this PR we fix a regression introduced in #16160. Currently when multiple class decorators are applied, they are provided with the unmodified classes, this is incorrect as per 15.7.7 ApplyDecoratorsToClassDefinition step 1.e, the next decorator should be applied on the modified class.

@babel-bot
Copy link
Collaborator

babel-bot commented Dec 30, 2023

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

Copy link
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

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

Can we rename the test case to decorator-access-modified-classes? We already have decorator-access-modified-{fields,methods} for the same purposes.

@JLHwung
Copy link
Contributor

JLHwung commented Dec 30, 2023

I updated the PR's description, I hope it can help reviewers pick up the PR's intention. Please do fill in the descriptions in the PR template, it will also help our future selves when trying to understand why changes are made.

@liuxingbaoyu
Copy link
Member Author

liuxingbaoyu commented Dec 30, 2023

Thanks!
In fact, the detailed description of the issue exists in #16198, and this PR only has small changes, and the added tests also help with review, so I did not add a detailed description. :)
The section on specs is really helpful, but I actually did this by comparing the code before regression was introduced.🤦‍♂️

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

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

👍

@JLHwung
Copy link
Contributor

JLHwung commented Jan 3, 2024

CI error is not related.

@JLHwung JLHwung merged commit 5c81253 into babel:main Jan 3, 2024
47 of 48 checks passed
@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 Apr 4, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: regression 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 Spec: Decorators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: decorators are broken and when applied, they override the preceding value.
4 participants