Skip to content

fix(parser): fix rhs precedence while parsing PrivateInExpression#10866

Merged
graphite-app[bot] merged 1 commit intomainfrom
05-07-fix_parser_fix_rhs_precedence_while_parsing_privateinexpression_
May 7, 2025
Merged

fix(parser): fix rhs precedence while parsing PrivateInExpression#10866
graphite-app[bot] merged 1 commit intomainfrom
05-07-fix_parser_fix_rhs_precedence_while_parsing_privateinexpression_

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented May 7, 2025

fixes #10839

class Foo {
  #name: string;
  f() { #name in other && this.#name === other.#name }
                 ^^^^^ rhs is only this part
}

RelationalExpression[In, Yield, Await] :
  [+In] PrivateIdentifier in ShiftExpression[?Yield, ?Await]

Copilot AI review requested due to automatic review settings May 7, 2025 13:59
@github-actions github-actions bot added A-parser Area - Parser A-codegen Area - Code Generation labels May 7, 2025
Copy link
Member Author

Boshen commented May 7, 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 7, 2025
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 a parsing bug in the handling of PrivateInExpression by adjusting the right-hand side operator precedence.

  • Changes the precedence argument in parse_binary_expression_or_higher from Precedence::Lowest to Precedence::Compare in the parser.
  • Adds an integration test to validate the correct parsing of expressions involving private identifiers.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
crates/oxc_parser/src/js/expression.rs Updates parser behavior for PrivateInExpression precedence handling
crates/oxc_codegen/tests/integration/ts.rs Adds integration test to verify the updated behavior

@codspeed-hq
Copy link

codspeed-hq bot commented May 7, 2025

CodSpeed Instrumentation Performance Report

Merging #10866 will not alter performance

Comparing 05-07-fix_parser_fix_rhs_precedence_while_parsing_privateinexpression_ (2c05fa1) with main (805735b)

Summary

✅ 36 untouched benchmarks

@Boshen Boshen force-pushed the 05-07-fix_parser_fix_rhs_precedence_while_parsing_privateinexpression_ branch from 9390beb to c47aedf Compare May 7, 2025 14:13
@github-actions github-actions bot added the A-transformer Area - Transformer / Transpiler label May 7, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented May 7, 2025

Merge activity

…10866)

fixes #10839

```
class Foo {
  #name: string;
  f() { #name in other && this.#name === other.#name }
                 ^^^^^ rhs is only this part
}

RelationalExpression[In, Yield, Await] :
  [+In] PrivateIdentifier in ShiftExpression[?Yield, ?Await]
```
@graphite-app graphite-app bot force-pushed the 05-07-fix_parser_fix_rhs_precedence_while_parsing_privateinexpression_ branch from c47aedf to 2c05fa1 Compare May 7, 2025 14:44
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label May 7, 2025
@graphite-app graphite-app bot merged commit 2c05fa1 into main May 7, 2025
27 checks passed
@graphite-app graphite-app bot deleted the 05-07-fix_parser_fix_rhs_precedence_while_parsing_privateinexpression_ branch May 7, 2025 14:51
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area - Code Generation A-parser Area - Parser A-transformer Area - Transformer / Transpiler C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AST issue for in operator on private field

2 participants