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

Do not offer 'use pattern matching' when it would change semantics #76404

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

CyrusNajmabadi
Copy link
Member

Fixes #39600

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner December 12, 2024 21:16
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 12, 2024
Comment on lines -119 to -121
// Don't convert if the as is part of a using statement
// eg using (var x = y as MyObject) { }
if (localStatement is UsingStatementSyntax)
Copy link
Member

Choose a reason for hiding this comment

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

This check for old school using statements is no longer needed because the analyzer is restricted to declarators in a local declaration statement, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

correct. :)

Copy link
Member

@DustinCampbell DustinCampbell left a comment

Choose a reason for hiding this comment

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

Looks good to me! Do you trust my Roslyn reviews though? 😄

@CyrusNajmabadi
Copy link
Member Author

Always :-)

@CyrusNajmabadi CyrusNajmabadi merged commit ab2864b into dotnet:main Dec 12, 2024
25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Dec 12, 2024
@CyrusNajmabadi CyrusNajmabadi deleted the patternMatchingMutation branch December 12, 2024 23:32
@dibarbet dibarbet modified the milestones: Next, 17.13 P3 Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IDE0019 suggests pattern matching but the generated pattern matching changes the meaning of the code
3 participants