-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Improve error recovery in parenthesized constructs #81279
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
base: main
Are you sure you want to change the base?
Conversation
|
@dotnet/roslyn-compiler this is ready for review. |
src/Compilers/CSharp/Test/Syntax/Parsing/ExpressionParsingTests.cs
Outdated
Show resolved
Hide resolved
| public void InProgressMultipleExpressionsInIfStatement2() | ||
| { | ||
| UsingTree(""" | ||
| if (1 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider testing if (1 2 3)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6953506. Note: recovery isn't great. But that's ok.
- it's no worse than before
- this is not an intermediary state. it woudl require deleting multiple discontinuous tokens to get here.
jcouv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with review pass (commit 7)
|
Maybe just "operator expected"? |
Meh, I guess. I'm not sure what to expect. I just know that the second expression is unexpected. |
|
I can just say |
jcouv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks (commit 10)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some tests for tuple expressions? And deconstruction assignments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added tests. Tuples retain the same poor behavior as before.
I'm not changing this as tuple expression parsing is more complex due to allowing declaration, and being comma separable not just having a close paren that follows but also a comma. Fixing would be move involved and I'd prefer to keep this pr simple and safe :).
Fixes #16595
Fixes #4009