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 incremental parsing error with dot-dot tokens. #75532

Closed

Conversation

Rekkonnect
Copy link
Contributor

@Rekkonnect Rekkonnect commented Oct 16, 2024

Fixes #74456

This was approved by @CyrusNajmabadi to open as a draft PR to debug. The test source is a minified example of that of the original PR.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Oct 16, 2024
@dotnet-policy-service dotnet-policy-service bot added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Oct 16, 2024
@@ -584,6 +584,62 @@ int LocalFunc()
WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot());
}

[Fact]
Copy link
Member

Choose a reason for hiding this comment

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

WorkItem :)

@CyrusNajmabadi
Copy link
Member

I'll look at this.

@@ -4118,7 +4118,7 @@ public void OperatorDeclaration_ExplicitImplementation_21()
UsingDeclaration("public int I..operator +(int x) => x;", options: options.WithLanguageVersion(LanguageVersion.Preview),
// (1,14): error CS1001: Identifier expected
// public int I..operator +(int x) => x;
Diagnostic(ErrorCode.ERR_IdentifierExpected, ".operato").WithLocation(1, 14)
Diagnostic(ErrorCode.ERR_IdentifierExpected, ".").WithLocation(1, 14)
Copy link
Member

Choose a reason for hiding this comment

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

these are better. the old results were wacky.

@CyrusNajmabadi CyrusNajmabadi changed the title Investigate incremental parsing error on spread collection expression Fix incremental parsing error with dot-dot tokens. Oct 16, 2024
@CyrusNajmabadi
Copy link
Member

@dotnet/roslyn-compiler for an incremental parsing bug.

@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review October 16, 2024 22:12
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner October 16, 2024 22:12
// on the dot token itself. This will make this token not reusable in incremental scenarios. The missing
// identifier is already not reusable (as it has zero length). However, this does not taint the tokens
// around it. We want that tainting so that an incremental reparse goes and resynthesizes the original `..`
// token.
Copy link
Member

Choose a reason for hiding this comment

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

this is the critical part of the fix. previously we had dot token - missing identifier - dot token and the incremental parser was reusing those dot tokens, even though they are not what the lexer would have produced.

@CyrusNajmabadi
Copy link
Member

@RikkiGibson @cston ptal.

@CyrusNajmabadi
Copy link
Member

Taking #75549 instead. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Community The pull request was submitted by a contributor who is not a Microsoft employee. untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nonsense identifier expected error depending on how you edit unrelated code
2 participants