Skip to content

Expected token errors should display all expected tokens, not just the first #43467

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

Open
sandersn opened this issue Mar 31, 2021 · 0 comments
Open
Labels
Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Experience Enhancement Noncontroversial enhancements Help Wanted You can do this
Milestone

Comments

@sandersn
Copy link
Member

πŸ•— Version & Regression Information

Pretty sure this has been the behaviour since the rewrite.

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

function a0([a, b, [[c]]]: [number, number, string[][]]) { }
a0([1, 2, [["world"]]);

πŸ™ Actual behavior

On the last ), "Expected ','."

πŸ™‚ Expected behavior

On the last ), "Expected ',' or ']'."

Right now the parser only shows the first error that starts at each location. This is an OK approach, especially when parsing has gone badly wrong, but often the parser will expect multiple tokens. The parser should report all the tokens in one error that were previously issued as multiple Expected_0 errors.

@sandersn sandersn added the Experience Enhancement Noncontroversial enhancements label Mar 31, 2021
@sandersn sandersn added this to the Backlog milestone Mar 31, 2021
@sandersn sandersn added Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Help Wanted You can do this labels Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Experience Enhancement Noncontroversial enhancements Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

1 participant