-
-
Notifications
You must be signed in to change notification settings - Fork 500
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(transformer/typescript): correctly resolve references to non-constant enum members #8543
fix(transformer/typescript): correctly resolve references to non-constant enum members #8543
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
CodSpeed Performance ReportMerging #8543 will not alter performanceComparing Summary
|
@Dunqing You wrote this transform and are more familiar with it. Would you be able to review please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks great overall, we can make further improvements after #8350 is done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this!
## [0.47.1] - 2025-01-19 ### Features - ee8ee55 napi/parser: Add `.hasChanged()` to `MagicString` (#8586) (Boshen) - 1bef911 napi/parser: Add source map API (#8584) (Boshen) ### Bug Fixes - 7b219a9 minifier: Fix dce shadowed undefined (#8582) (Boshen) - 7421a52 transformer/typescript: Correctly resolve references to non-constant enum members (#8543) (branchseer) Co-authored-by: Boshen <[email protected]>
Follow up from #8543 (comment) > I agree. https://github.com/oxc-project/backlog/issues/155 > Originally we were considering some form of interning and reference-counting, so we didn't make it Copy to leave the door open for that. But now all strings are stored in the arena anyway, so even if we did decide to intern strings, reference-counting would be irrelevant - our bump allocator doesn't allow freeing individual allocations anyway. Most of the changes are done automatically by `just fix` (`cargo clippy --fix` && `cargo fmt --all`). See the commit list for the manual edits.
…outer scope (#8691) ```typescript var x = 10; enum Merge { x = Math.random() } enum Merge { y = x // <-- refers to Merge.x } ``` This case wasn't covered in #8543 and by the [babel test case](https://github.com/babel/babel/blob/e568916ef3e5fd288039a65c904b12a7eba2a73a/packages/babel-plugin-transform-typescript/test/fixtures/enum/non-constant-member-reference/input.ts). To handle it we still have to go through the scope ancestors. --------- Co-authored-by: Dunqing <[email protected]>
fixes #8342