Skip to content

Issue/34870 #35586

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

Merged
merged 3 commits into from
Dec 10, 2019
Merged

Issue/34870 #35586

merged 3 commits into from
Dec 10, 2019

Conversation

marcin-serwin
Copy link
Contributor

Fixes #34870

Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you could also undo the unrelated whitespace changes, that'd be swell.

Comment on lines 5065 to 5074
if (token() !== SyntaxKind.CloseBraceToken) {
const lastError = lastOrUndefined(parseDiagnostics);
const start = scanner.getTokenPos();
if (!lastError || start !== lastError.start) {
parseErrorAt(openBracePosition, openBracePosition + 1, Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here);
}
}
else {
parseExpected(SyntaxKind.CloseBraceToken)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than this, since we want a related span (not a change to the original span), consider:

if (!parseExpected(SyntaxKind.CloseBraceToken)) {
    const lastError = lastOrUndefined(parseDiagnostics)!;
    addRelatedInfo(lastError, createFileDiagnostic(sourceFile, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick response. I've introduced the requested changes and fixed the linting errors.

Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it - cc @DanielRosenwasser for a review of the copy - once you're satisfied, give it a merge.

@DanielRosenwasser DanielRosenwasser merged commit f8cacf9 into microsoft:master Dec 10, 2019
@DanielRosenwasser
Copy link
Member

I love it too - thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Related spans on missing list/block/function body terminators
3 participants