Skip to content

fix(traverse): handle ChainElement::TSNonNullExpression in GatherNodeParts#22247

Merged
graphite-app[bot] merged 1 commit into
mainfrom
05-08-fix_traverse_handle_chainelement_tsnonnullexpression
May 11, 2026
Merged

fix(traverse): handle ChainElement::TSNonNullExpression in GatherNodeParts#22247
graphite-app[bot] merged 1 commit into
mainfrom
05-08-fix_traverse_handle_chainelement_tsnonnullexpression

Conversation

@leaysgur
Copy link
Copy Markdown
Member

@leaysgur leaysgur commented May 8, 2026

Fixes #22246, transformer panics with const x = a[b?.c!]?.["d"]; under es2020 target.

(I wasn't sure where to put the test, but I've confirmed that it works on my end for now.)

@leaysgur leaysgur requested a review from overlookmotel as a code owner May 8, 2026 06:00
Copy link
Copy Markdown
Member Author

leaysgur commented May 8, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of 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.

@leaysgur leaysgur requested a review from Dunqing May 8, 2026 06:00
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 8, 2026

Merging this PR will not alter performance

✅ 44 untouched benchmarks
⏩ 7 skipped benchmarks1


Comparing 05-08-fix_traverse_handle_chainelement_tsnonnullexpression (ad682e2) with main (0eeceaf)2

Open in CodSpeed

Footnotes

  1. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (ca8fb74) during the generation of this report, so 0eeceaf was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Comment thread crates/oxc_traverse/src/ast_operations/gather_node_parts.rs Outdated
@Dunqing
Copy link
Copy Markdown
Member

Dunqing commented May 8, 2026

@leaysgur leaysgur force-pushed the 05-08-fix_traverse_handle_chainelement_tsnonnullexpression branch from 1f91a0d to 9ecbaab Compare May 8, 2026 13:24
@github-actions github-actions Bot added the A-transformer Area - Transformer / Transpiler label May 8, 2026
@leaysgur leaysgur force-pushed the 05-08-fix_traverse_handle_chainelement_tsnonnullexpression branch from 9ecbaab to 27f587c Compare May 8, 2026 13:25
@leaysgur
Copy link
Copy Markdown
Member Author

leaysgur commented May 8, 2026

@Dunqing Test added, PTAL~ 🙏🏻

@Dunqing Dunqing added the 0-merge Merge with Graphite Merge Queue label May 11, 2026
Copy link
Copy Markdown
Member

Dunqing commented May 11, 2026

Merge activity

  • May 11, 9:14 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • May 11, 9:14 AM UTC: Dunqing added this pull request to the Graphite merge queue.
  • May 11, 9:20 AM UTC: The Graphite merge queue couldn't merge this PR because it had merge conflicts.
  • May 11, 9:33 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • May 11, 9:36 AM UTC: camc314 added this pull request to the Graphite merge queue.
  • May 11, 9:41 AM UTC: Merged by the Graphite merge queue.

@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label May 11, 2026
@camc314 camc314 changed the title fix(traverse): Handle ChainElement::TSNonNullExpression fix(traverse): handle ChainElement::TSNonNullExpression in GatherNodeParts May 11, 2026
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label May 11, 2026
…odeParts` (#22247)

Fixes #22246, transformer panics with `const x = a[b?.c!]?.["d"];` under es2020 target.

(I wasn't sure where to put the test, but I've confirmed that it works on my end for now.)
@graphite-app graphite-app Bot force-pushed the 05-08-fix_traverse_handle_chainelement_tsnonnullexpression branch from ad682e2 to d3d0b18 Compare May 11, 2026 09:37
@graphite-app graphite-app Bot merged commit d3d0b18 into main May 11, 2026
29 checks passed
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label May 11, 2026
@graphite-app graphite-app Bot deleted the 05-08-fix_traverse_handle_chainelement_tsnonnullexpression branch May 11, 2026 09:41
camc314 added a commit that referenced this pull request May 11, 2026
### 🚀 Features

- 66c9b01 transformer/typescript: Debug_assert that `enum_eval` ran in
semantic (#22252) (Dunqing)
- ffe6475 minifier: Fold `Array` constructor with safe spreads (#22215)
(camc314)

### 🐛 Bug Fixes

- d3d0b18 traverse: Handle `ChainElement::TSNonNullExpression` in
`GatherNodeParts` (#22247) (leaysgur)
- 4e880de transformer/object-rest-spread: Declare temp vars for computed
keys (#22284) (camc314)
- a7c3e22 semantic: Clear member write target for computed keys (#22302)
(camc314)
- 6a8852d codegen: Emit newline after legal-comment orphan flush
(#22304) (Dunqing)
- 5da9fda transformer/explicit-resource-management: Preserve class names
(#22306) (Dunqing)
- b5d970f transformer/explicit-resource-management: Preserve class names
(#22290) (camc314)
- bc54fd4 minifier: Keep function / class names if direct eval is
present in the scope (#22241) (sapphi-red)
- 7a810c0 minifier: Refresh direct eval flags after DCE (#21787)
(Dunqing)
- dd88726 transformer/legacy-decorator: Preserve accessor type
annotation for emitDecoratorMetadata (#21966) (Dunqing)
- 29a3cd7 codegen: Swap mapping/indent order for top-level decls
(#22206) (Dunqing)
- 73b4f40 minifier: Preserve catch binding with direct eval (#22221)
(camc314)
- 0e13d17 minifier: Preserve optional chain base side effects (#22219)
(camc314)
- 0c7c01c transformer/typescript: Inline optional-chain enum member
access (#21834) (Dunqing)
- a6aff7e codegen: Emit block/array/object end mapping at close char
(#22200) (Dunqing)
- a099b03 codegen: Emit call end mapping at `)` position, not past it
(#22199) (Dunqing)
- 5753774 minifier: Cap if-return ternary collapse for firefox (#21841)
(Gurupungav Narayanan)
- 2493bdd codegen: Correct sourcemap end mappings for closing delimiters
(#22001) (Mark Dalgleish)
- 3b385e2 minifier: Bail optimizing `Array` with unknown arg count
(#22188) (camc314)
- 9fa2122 parser: Parse array computed class keys (#22159) (camc314)

### 📚 Documentation

- a4a6892 napi/parser: Correct code comment (#22278) (overlookmotel)
- 9305373 oxc: Update README (#22178) (camc314)

Co-authored-by: Cameron <cameron.clark@hey.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-transformer Area - Transformer / Transpiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

oxc-transform panics on a[b?.c!]?.["d"] 😱 when target lowers optional chaining

3 participants