Skip to content

fix(transformer/optional-chaining): optional chaining expression isn't being transformed correctly when inside a double call expression#11179

Merged
graphite-app[bot] merged 1 commit intomainfrom
05-20-fix_transformer_optional-chaining_optional_chaining_expression_isn_t_being_transformed_correctly_when_inside_a_double_call_expression
May 20, 2025
Merged

fix(transformer/optional-chaining): optional chaining expression isn't being transformed correctly when inside a double call expression#11179
graphite-app[bot] merged 1 commit intomainfrom
05-20-fix_transformer_optional-chaining_optional_chaining_expression_isn_t_being_transformed_correctly_when_inside_a_double_call_expression

Conversation

@Dunqing
Copy link
Member

@Dunqing Dunqing commented May 20, 2025

close: #11141

@github-actions github-actions bot added the A-transformer Area - Transformer / Transpiler label May 20, 2025
Copy link
Member Author

Dunqing commented May 20, 2025


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 hot fixes, skip the queue and merge this PR next

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.

@github-actions github-actions bot added the C-bug Category - Bug label May 20, 2025
@Dunqing Dunqing force-pushed the 05-20-fix_transformer_optional-chaining_optional_chaining_expression_isn_t_being_transformed_correctly_when_inside_a_double_call_expression branch from 4372c24 to f5a19f6 Compare May 20, 2025 01:56
@Dunqing Dunqing marked this pull request as ready for review May 20, 2025 01:58
Copilot AI review requested due to automatic review settings May 20, 2025 01:58
@Dunqing Dunqing requested a review from overlookmotel as a code owner May 20, 2025 01:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses the bug where an optional chaining expression inside a double call expression wasn't transformed correctly. Key changes include:

  • Adding the "transform-optional-chaining" plugin configuration in the test fixtures.
  • Updating the expected output and input for the double call expression test case.
  • Modifying the transformer logic in optional_chaining.rs to correctly handle the parenthesized expression in call expression scenarios.
  • Updating the snapshot to reflect the new transformation output.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tasks/transform_conformance/tests/babel-plugin-transform-optional-chaining/test/fixtures/options.json Adds plugin configuration for testing.
tasks/transform_conformance/tests/babel-plugin-transform-optional-chaining/test/fixtures/inside-double-call-expression/output.js Updates transformed output for double call expressions.
tasks/transform_conformance/tests/babel-plugin-transform-optional-chaining/test/fixtures/inside-double-call-expression/input.js Provides input cases with optional chaining expressions.
tasks/transform_conformance/snapshots/oxc.snap.md Updates transformation snapshots.
crates/oxc_transformer/src/es2020/optional_chaining.rs Adjusts transformation logic with an additional parenthesized expression check.
Comments suppressed due to low confidence (1)

crates/oxc_transformer/src/es2020/optional_chaining.rs:343

  • Consider adding a comment explaining why the is_parenthesized_expression check is required in this condition. This will help future maintainers understand the context behind this extra guard.
if ctx.parent().is_parenthesized_expression() && matches!(ctx.ancestor(1), Ancestor::CallExpressionCallee(_)) {

@codspeed-hq
Copy link

codspeed-hq bot commented May 20, 2025

CodSpeed Instrumentation Performance Report

Merging #11179 will degrade performances by 12.05%

Comparing 05-20-fix_transformer_optional-chaining_optional_chaining_expression_isn_t_being_transformed_correctly_when_inside_a_double_call_expression (907e114) with main (fcd5ba9)

Summary

❌ 1 regressions
✅ 37 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
mangler[cal.com.tsx] 3.1 ms 3.5 ms -12.05%

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label May 20, 2025
Copy link
Member

Boshen commented May 20, 2025

Merge activity

…t being transformed correctly when inside a double call expression (#11179)

close: #11141
@graphite-app graphite-app bot force-pushed the 05-20-fix_transformer_optional-chaining_optional_chaining_expression_isn_t_being_transformed_correctly_when_inside_a_double_call_expression branch from f5a19f6 to 907e114 Compare May 20, 2025 02:07
@graphite-app graphite-app bot merged commit 907e114 into main May 20, 2025
23 of 24 checks passed
@graphite-app graphite-app bot deleted the 05-20-fix_transformer_optional-chaining_optional_chaining_expression_isn_t_being_transformed_correctly_when_inside_a_double_call_expression branch May 20, 2025 02:14
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-transformer Area - Transformer / Transpiler C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

transformer: unsafe transform - bind with optional chaining

3 participants