Fix !! incremental parsing#59977
Conversation
|
Look for a method that has 'Fabricated' in its name. That should be what we are updating. |
|
There is |
CyrusNajmabadi
left a comment
There was a problem hiding this comment.
Needs a tweak. If you can't find the relevant method, LMK and i can hunt it down on monday. THanks!
|
@CyrusNajmabadi Thanks for the hint! |
| { | ||
| case SyntaxKind.GreaterThanGreaterThanToken: | ||
| case SyntaxKind.GreaterThanGreaterThanEqualsToken: | ||
| case SyntaxKind.ExclamationExclamationToken: |
There was a problem hiding this comment.
my bad on forgetting about this @Youssef1313 @RikkiGibson . The merging tokens bit totally should have triggered things for me!
There was a problem hiding this comment.
Consider adding a note to MergeAdjacent to mention this method should be updated when used.
There was a problem hiding this comment.
Consider adding a note to MergeAdjacent to mention this method should be updated when used.
It looks LanguageParser.ParseLambdaExpression() also uses MergeAdjacent() for SyntaxKind.EqualsGreaterThanToken. If there's a potential incremental parsing bug there, we should open an issue.
There was a problem hiding this comment.
Consider adding an assert to MergeAdjacent(): Debug.Assert(IsFabricatedToken(kind));
|
@RikkiGibson @cston for second review. Thanks |
| @@ -432,7 +463,6 @@ public void TestStatementToGlobalStatementChange() | |||
| SyntaxKind.IdentifierName, | |||
| SyntaxKind.SemicolonToken); | |||
| } | |||
CyrusNajmabadi
left a comment
There was a problem hiding this comment.
changing my vote. we're jsut asking to eb be bitten by the other merged token. we should just fix the code now and not have some random tree corruption issue someone has to figure out months down the line :)
making sure I understand your concern here. Are you asking that #60002 be addressed now and not afterwards? Since we do have #60005 open currently which should address it. |
That adds the assert (which is good). But i see no code change that adds the merged token taht the parser is creating to the blnder-reader to make sure we don't try to reuse that. or is the theory there that that's ok because |
CyrusNajmabadi
left a comment
There was a problem hiding this comment.
retracting my objection.
not clear enough if that is hte actual fix.
|
@Youssef1313 do you think it's reasonable to do #59977 (comment) as part of this PR, just to ensure it's all out of the way? |
|
@RikkiGibson This one is now already merged. I'm not sure it will be easy to reproduce the problem with lambdas parsing. The roslyn/src/Compilers/CSharp/Portable/Parser/LanguageParser.cs Lines 13018 to 13031 in 347cd02 Per @CyrusNajmabadi explanation, this is in general not correct because the merged token can be moved to a place where it contextually have a different meaning and hence a different SyntaxKind. But for this specific case:
Since The question is: Should we add it to |
Fixes #59580
cc @RikkiGibson @tmat
Relates to test plan #36024