Skip to content

Fix incremental parsing error with dot-dot tokens.#75532

Closed
Rekkonnect wants to merge 12 commits intodotnet:mainfrom
Rekkonnect:fix/74456-incremental-parsing-dotdot
Closed

Fix incremental parsing error with dot-dot tokens.#75532
Rekkonnect wants to merge 12 commits intodotnet:mainfrom
Rekkonnect:fix/74456-incremental-parsing-dotdot

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.

@ghost ghost 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
WalkTreeAndVerify(tree.GetCompilationUnitRoot(), fullTree.GetCompilationUnitRoot());
}

[Fact]
Copy link
Contributor

Choose a reason for hiding this comment

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

WorkItem :)

@CyrusNajmabadi
Copy link
Contributor

I'll look at this.

// (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
Contributor

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
Contributor

@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
Contributor

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
Contributor

@RikkiGibson @cston ptal.

@CyrusNajmabadi
Copy link
Contributor

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