-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
support CasePatternSwitchLabel in StatementSyntaxComparer #19164
Conversation
rightNode.Parent != null && | ||
GetLabel(leftNode.Parent) == GetLabel(rightNode.Parent)) | ||
{ | ||
parentDistance = ComputeDistance(leftNode.Parent, rightNode.Parent); |
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.
I think this is a good idea, but wonder if we need to tailor it a bit more to switch case.
In future C# will support complex pattern matching in switch, so the direct parent of a variable designation won't be the case label.
How about find the first containing node that has a label instead of the direct parent?
#Resolved
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.
Le'ts keep it as is and file an issue to track the generalization. #Resolved
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.
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.
👍 |
Tagging @MattGertz for ask mode approval |
Customer scenario
Variables declared by patterns within switch statements are matched incorrectly by StatementSyntaxComparer. Fixing this. Have to add one more pass for the matcher. It does not affect the performance. However, it would be nice to re-consider this. Created #19163.
Bugs this fixes:
Fixes #18970
Workarounds, if any
Risk
Low
Performance impact
Low
Is this a regression from a previous update?
Root cause analysis:
How did we miss it? What tests are we adding to guard against it in the future?
How was the bug found?
Planned