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

Fix incorrect parser error assumption in semicolon handling leading to incremental parser brokenness #48067

Merged
merged 2 commits into from Mar 1, 2022

Conversation

jakebailey
Copy link
Member

@jakebailey jakebailey commented Feb 28, 2022

#43005 added special handling for missing semicolons to attempt to produce better errors. Unfortunately, it made an incorrect assumption about when the tokenizer would have already reported an error. This led to a class node with a syntax error being created without the flag noting that it contained an error (there's an initializer, but there's not a brace after it), which then led to the incremental parser trying to use that node rather than deciding it was unsafe.

Just remove this assumption; this fixes the new test case, and only reverts one error change introduced in #43005 (which doesn't seem correct to me anyway).

Fixes #47895

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Feb 28, 2022
@jakebailey jakebailey merged commit e4fe50c into microsoft:main Mar 1, 2022
@DanielRosenwasser
Copy link
Member

@typescript-bot cherry-pick this to release-4.6

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 1, 2022

Heya @DanielRosenwasser, I've started to run the task to cherry-pick this into release-4.6 on this PR at 64cfd70. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

Hey @DanielRosenwasser, I've opened #48068 for you.

typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this pull request Mar 1, 2022
Component commits:
8d6b965 Add failing test

64cfd70 Fix incorrect parser error assumption in semicolon handling leading to incremental parser brokenness
jakebailey added a commit that referenced this pull request Mar 1, 2022
…e-4.6 (#48068)

Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
@jakebailey jakebailey deleted the fix-47895 branch October 20, 2022 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeScript diagnostics gets corrupted after typing Map
4 participants