-
-
Notifications
You must be signed in to change notification settings - Fork 471
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/class-properties): unwrap failed when private field expression doesn't contain optional expression in ChainExpression
#7798
fix(transformer/class-properties): unwrap failed when private field expression doesn't contain optional expression in ChainExpression
#7798
Conversation
Your org has enabled the Graphite merge queue for merging into mainAdd the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
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. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Performance ReportMerging #7798 will not alter performanceComparing Summary
|
86bc6d2
to
fe2ffae
Compare
b2bfacf
to
bcb1ea8
Compare
fe2ffae
to
6fa6785
Compare
bcb1ea8
to
6613461
Compare
6613461
to
4e479cb
Compare
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.
I can't say I understand optional chain transform, so can't really say if correct or not. But it seems you understand it!
Merge activity
|
…xpression doesn't contain optional expression in `ChainExpression` (#7798) The root cause is due to transform wrongly a PrivateFieldExpression that doesn't contain any optional expression, so call `to_member_expression_mut` causes unwrap to fail. I have fixed the incorrect transform and changed `to_member_expression_mut` to `as_member_expression_mut`.
4e479cb
to
2964a61
Compare
Follow-on after #7798. Pure refactor, just shorten code. I *think* `expect` has same behavior as `unreachable!` in terms of making the compiler backtrack to try to prove the check can be elided. But in this case, I doubt it can prove it either way.
Follow-on after #7798. Pure refactor. Include `transform_chain_element_recursively` call once instead of twice.
## [0.41.0] - 2024-12-13 - fb325dc ast: [**BREAKING**] `span` field must be the first element (#7821) (Boshen) - 96a26d3 ast: [**BREAKING**] Rename `is_strict` methods to `has_use_strict_directive` (#7783) (overlookmotel) ### Features - 8991f33 ast: Add `visit_span` to `Visit` and `VisitMut` (#7816) (overlookmotel) - f7900ab ast: Add `ArrowFunctionExpression::has_use_strict_directive` method (#7784) (overlookmotel) - e727ae9 transformer/class-properties: Transform super member expressions that are inside static prop initializer (#7815) (Dunqing) ### Bug Fixes - 7610dc1 parser: Parse `import source from 'mod'` (#7833) (Boshen) - 9479e2b semantic: Missing references when `export {}` references a type-only binding and a normal (#7812) (Yunfei He) - 7a83230 semantic: Missing reference when `export default` references a type alias binding (#7813) (Dunqing) - 4a3bca8 semantic: Fix identifying strict mode arrow functions (#7785) (overlookmotel) - 5b7e1ad transformer: Remove span of define value (#7811) (Hiroshi Ogawa) - 14896cb transformer/class-properties: Create temp vars in correct scope (#7824) (overlookmotel) - 25bb6da transformer/class-properties: Fix `ScopeId`s in instance prop initializers (#7823) (overlookmotel) - 65b109a transformer/class-properties: No `raw` for generated `StringLiteral` (#7825) (overlookmotel) - 2964a61 transformer/class-properties: Unwrap failed when private field expression doesn't contain optional expression in `ChainExpression` (#7798) (Dunqing) - 6fa6785 transformer/class-properties: Panic when the callee or member is `ParenthesisExpression` or TS-syntax expressions. (#7795) (Dunqing) - bb22c67 transformer/class-properties: Fix `ScopeId`s in static prop initializers (#7791) (overlookmotel) - caa57f1 transformer/class-properties: Fix scope flags in static prop initializers (#7786) (overlookmotel) ### Performance - 4448b63 codegen: Faster writing indentation (#7820) (overlookmotel) - afaaffa codegen: Fast path for `options.print_comments()` (#7806) (Boshen) ### Refactor - 0f367e5 semantic: Improve the logic of resolving references to be cleaner (#7829) (Dunqing) - 5710950 semantic: Move export-related reference flags logic to visit functions (#7828) (Dunqing) - b290ebd transformer: Handle `<CWD>` in test runner (#7799) (Dunqing) - e70deb9 transformer/class-properties: Locate instance props insertion location in separate step (#7819) (overlookmotel) - afc5f1e transformer/class-properties: De-deduplicate code (#7805) (overlookmotel) - 47a91d2 transformer/class-properties: Shorten code (#7804) (overlookmotel) - 54ef2b9 transformer/class-properties: Rename `debug_assert_expr_is_not_parenthesis_or_typescript_syntax` (#7803) (overlookmotel) - 3cdc47c transformer/class-properties: `#[inline(always)]` on `assert_expr_neither_parenthesis_nor_typescript_syntax` (#7802) (overlookmotel) ### Testing - d72c888 transformer/replace-global-defines: Remove panicking test (#7838) (overlookmotel) Co-authored-by: Boshen <[email protected]>
The root cause is due to transform wrongly a PrivateFieldExpression that doesn't contain any optional expression, so call
to_member_expression_mut
causes unwrap to fail. I have fixed the incorrect transform and changedto_member_expression_mut
toas_member_expression_mut
.