Skip to content

fix(codegen): remove unnecessary double parentheses from satisfies expressions#17986

Merged
graphite-app[bot] merged 1 commit intomainfrom
fix/codegen-satisfies-parens
Jan 14, 2026
Merged

fix(codegen): remove unnecessary double parentheses from satisfies expressions#17986
graphite-app[bot] merged 1 commit intomainfrom
fix/codegen-satisfies-parens

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Jan 14, 2026

Summary

  • Fixed TSSatisfiesExpression to only add parentheses when precedence requires it
  • Before: ((x) satisfies y), After: x satisfies y
  • Aligned implementation with TSAsExpression pattern
  • Added idempotency tests to ensure semantic correctness

Test plan

  • Added ts_satisfies_expression test with 9 idempotency test cases
  • All codegen tests pass
  • Clippy passes

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings January 14, 2026 08:51
@github-actions github-actions bot added A-codegen Area - Code Generation C-bug Category - Bug labels Jan 14, 2026
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 fixes unnecessary double parentheses in the code generation for TypeScript satisfies expressions. The implementation previously always wrapped satisfies expressions with double parentheses (e.g., ((x) satisfies y)), which was incorrect and inconsistent with how as expressions are handled.

Changes:

  • Refactored TSSatisfiesExpression code generation to only add parentheses when precedence requires it
  • Aligned implementation with the existing TSAsExpression pattern
  • Added comprehensive idempotency tests covering 9 different scenarios

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
crates/oxc_codegen/src/gen.rs Refactored TSSatisfiesExpression::gen_expr to use precedence-based wrapping logic matching TSAsExpression, removing unconditional double parentheses
crates/oxc_codegen/tests/integration/ts.rs Added 9 idempotency test cases covering various precedence scenarios (member access, calls, logical operators, equality)
crates/oxc_codegen/tests/integration/snapshots/ts.snap Updated snapshot showing removal of unnecessary parentheses from ((x) satisfies y) to x satisfies y
crates/oxc_codegen/tests/integration/snapshots/pure_comments.snap Updated snapshots showing correct handling of satisfies expressions with pure comments
crates/oxc_codegen/tests/integration/snapshots/minify.snap Updated minified output snapshot reflecting the parentheses fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Jan 14, 2026
Copy link
Member Author

Boshen commented Jan 14, 2026

Merge activity

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 14, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing fix/codegen-satisfies-parens (1e24a21) with main (1874765)

Summary

✅ 42 untouched benchmarks
⏩ 3 skipped benchmarks1

Footnotes

  1. 3 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.

…pressions (#17986)

## Summary
- Fixed `TSSatisfiesExpression` to only add parentheses when precedence requires it
- Before: `((x) satisfies y)`, After: `x satisfies y`
- Aligned implementation with `TSAsExpression` pattern
- Added idempotency tests to ensure semantic correctness

## Test plan
- [x] Added `ts_satisfies_expression` test with 9 idempotency test cases
- [x] All codegen tests pass
- [x] Clippy passes

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@graphite-app graphite-app bot force-pushed the fix/codegen-satisfies-parens branch from 1e24a21 to 06bd17b Compare January 14, 2026 08:57
@graphite-app graphite-app bot merged commit 06bd17b into main Jan 14, 2026
20 checks passed
@graphite-app graphite-app bot deleted the fix/codegen-satisfies-parens branch January 14, 2026 09:03
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area - Code Generation C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants