Skip to content
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

Semantic syntax checker mis-resolves private fields in class computed fields #7581

Closed
overlookmotel opened this issue Dec 2, 2024 · 2 comments
Assignees
Labels
A-semantic Area - Semantic C-bug Category - Bug

Comments

@overlookmotel
Copy link
Contributor

overlookmotel commented Dec 2, 2024

Private fields in computed keys resolve to private properties of enclosing class. So obj.#x does not reference C's #x binding here, and in both cases it should be a syntax error:

class C {
  #x;
  [obj.#x]() {}
  [obj.#x] = 123;
}

Oxc playground

@overlookmotel overlookmotel added C-bug Category - Bug A-semantic Area - Semantic labels Dec 2, 2024
@Boshen Boshen self-assigned this Dec 2, 2024
@Boshen
Copy link
Member

Boshen commented Dec 4, 2024

VM185:4 Uncaught TypeError: Cannot read properties of undefined (reading '#x')
    at <anonymous>:4:8

runtime error, not syntax.

@Boshen Boshen closed this as not planned Won't fix, can't repro, duplicate, stale Dec 4, 2024
@overlookmotel
Copy link
Contributor Author

Confirmed I was wrong. #x in obj.#x in example above resolves to the class's #x private property. So it's not a syntax error. False alarm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-semantic Area - Semantic C-bug Category - Bug
Projects
None yet
Development

No branches or pull requests

2 participants