microsoft / microsoft/TypeScript
Parsing issue for call expression with type arguments following left-shift
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: 3.8.3
Search Terms: left shift, type parameter
Expected behavior: Syntax highlighting stays intact.
Actual behavior: Syntax highlighting breaks, even with ts-ignore.
Code
function alignof<T>(): number {
return 1;
}
// works
function foo<T>(): number {
return 1 >> alignof<T[]>();
}
// breaks
function bar<T>(): number {
return 1 << alignof<T[]>();
}
// still breaks, does not ignore
function baz<T>(): number {
// @ts-ignore
return 1 << alignof<T[]>();
}
Looks like a rescan issue on potentially ambiguous < tokens, attempting to interpret as 1 < <type>.
Playground Link: Provided
Contributor guide
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.
Research direction
Start with the provided TypeScript Playground reproduction and compare the working right-shift example with the failing left-shift example. Inspect parser rescan handling for ambiguous < tokens in call expressions with type arguments. Done means syntax highlighting remains intact for the bar and baz examples, including when // @ts-ignore is present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100