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

support CasePatternSwitchLabel in StatementSyntaxComparer #19164

Merged
merged 1 commit into from
May 16, 2017

Conversation

ivanbasov
Copy link
Contributor

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

rightNode.Parent != null &&
GetLabel(leftNode.Parent) == GetLabel(rightNode.Parent))
{
parentDistance = ComputeDistance(leftNode.Parent, rightNode.Parent);
Copy link
Member

@tmat tmat May 11, 2017

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

Copy link
Member

@tmat tmat May 16, 2017

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you! The issue for tracking this was created: #19163


In reply to: 116822476 [](ancestors = 116822476)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you! Let us consider this with #19163


In reply to: 116111605 [](ancestors = 116111605)

@tmat
Copy link
Member

tmat commented May 16, 2017

👍

@ivanbasov
Copy link
Contributor Author

Tagging @MattGertz for ask mode approval

@ivanbasov ivanbasov merged commit 2ccd496 into dotnet:master May 16, 2017
@ivanbasov ivanbasov deleted the switch branch May 16, 2017 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support CasePatternSwitchLabel in StatementSyntaxComparer
5 participants