[P2] Parser rejects ECMAScript private getter and setter names

Open
#3,483 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp, typescript
Domain
compilers

Research direction

Start with ParseAccessorName and the parser tests or harnesses for class accessors; the issue reports the failure occurs before either engine runs. Compare private getter and setter syntax with the already supported public accessors and private fields or methods, then check how the parser preserves class-owned private-name identity and brands. Done means both engines accept getter-only and setter-only private accessors while enforcing duplicate and brand restrictions, separately from #3477's element transport work.

Written by the indexing model from the issue text.

Description

bug priority: P2

ECMAScript private accessor syntax is rejected before either execution engine can run:

class C { get #value() { return 7; } read() { return this.#value; } }
console.log(new C().read());

Pinned TypeScript 6.0.3 accepts the exact source with strict ES2022 checking; TypeScript transpilation + Node prints 7. SharpTS reports Expect property name after 'get'/'set' from ParseAccessorName. The same failure occurs in both interpreter/compiler test harnesses, before code generation.

This is a preexisting parser boundary, independently discovered by adding an extra private-accessor-only brand control while reviewing #3477. The unchanged earlier compiler DLL SHA256 72563E1051FECE31449F16EADD5194BD36306A6092930BF230FBE0652218ACBD reproduces the parse rejection. git diff origin/main -- src/SharpTS/Parsing is empty. Ordinary public accessors and ECMAScript private fields/methods are separate supported grammar; this issue does not claim a regression in lexical-super element transport.

All-state searches for private accessor/parser, private getter and ParseAccessorName found no focused grammar issue. Closed #2204 concerns TypeScript private accessor visibility, not #name accessor syntax; #2419 concerns accessibility ordering.

Acceptance: parse ECMAScript private getter/setter names and retain their class-owned private-name identity/brand in both engines, including getter-only and setter-only forms and duplicate/brand restrictions. Keep the syntax work separate from #3477's supported element transport repair.

Evidence: artifacts/p3-checker/private-accessor-parser.ts, private-accessor-ts.log, private-accessor-before.log, private-accessor-parser-evidence.json, and lexical-special-oracles-before-private-accessor-split.json (the private-accessor row matches TypeScript6.0.3+Node).

Dominant language
C#
Stars
156
Forks
4
Avg merge
15h 1m
Merged PRs (30d)
42

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nickna/SharpTS

All issues in nickna/SharpTS

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.