[P2] Parser rejects contextual keywords as class declaration names
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- csharp, typescript
Research direction
Start with Parser.Classes.cs, especially ClassDeclaration, and trace how it recognizes class names and distinguishes contextual keywords from reserved words. Compare the accepted syntax with TypeScript’s behavior, then run the parser tests or the reproduction with class type. Done means contextual keywords valid in this position are accepted while invalid reserved words and ordinary identifier class names retain their behavior.
Written by the indexing model from the issue text.
Description
Reproduction
class type {
static create() {}
instanceMethod() {}
}
Pinned TypeScript 6.0.3 accepts this source with --strict --target ES2022 --noEmit --skipLibCheck (exit 0).
SharpTS rejects it with Expect class name. before constructing the class AST. Parser.Classes.cs:ClassDeclaration currently consumes only TokenType.IDENTIFIER, although type is a valid contextual keyword in this identifier position.
Observed impact
The same declaration submitted to the REPL emits parser errors, leaves the accumulated statement list empty, and consequently cannot provide type. static-member completion. This is independent of the recent REPL token-origin fix: the class declaration fails before completion/type checking.
Regression provenance
The source fails identically in the retained clean base build from before PR #2504 (SharpTS DLL SHA256 FAA3C1907C5A578E4D18183D59D20BA4527A68BD1090EF99E786757713D3F82A) and the current build (DLL SHA256 F5934D2719A513245BB4FE8B4F492940584FFB5CD0BE28588736C6CA03C6CFDF). This is a preexisting parser gap, not a regression introduced by that PR.
All-state deduplication found related closed contextual-keyword/property-name reports #28, #36, and #138; those cover other syntactic positions rather than class declaration names.
Expected
Accept contextual keywords that TypeScript permits as class declaration names, while continuing to reject reserved words that are invalid in that position. Keep ordinary identifier class declarations working.
- Dominant language
- C#
- Stars
- 156
- Forks
- 4
- Avg merge
- 6h 25m
- Merged PRs (30d)
- 43
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nickna/SharpTS
-
[P2] Interpreter: qualified globalThis.isNaN keeps strict Number.isNaN semantics for coercible argumentsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
[P2] Interpreter: global isNaN treats null and empty string as NaNPossibly taken @Nitjsefnie claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
priority: P2
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
nickna/SharpTS#2632 · 1 comment ·
Maintainers usually reply within 1 day
-
priority: P2
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
Similar issues
-
needs attention public-client untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
AzureAD/microsoft-authentication-library-for-dotnet#6242 ·
Maintainers usually reply within 2 days
-
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
criticalmanufacturing/cli#882 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Dome-Works/DOME#129 ·
Maintainers usually reply within 1 day
-
bug sev:L
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Systemorph/MeshWeaver#7480 ·
Maintainers usually reply within 1 day
-
bug small tooling
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day