Skip to content

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

Merged
CyrusNajmabadi merged 1 commit intodotnet:mainfrom
CyrusNajmabadi:patternMatchingMutation
Dec 12, 2024
Merged

Do not offer 'use pattern matching' when it would change semantics#76404
CyrusNajmabadi merged 1 commit intodotnet:mainfrom
CyrusNajmabadi:patternMatchingMutation

Conversation

@CyrusNajmabadi
Copy link
Contributor

Fixes #39600

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner December 12, 2024 21:16
@ghost ghost 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
Contributor 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
Contributor Author

Always :-)

@CyrusNajmabadi CyrusNajmabadi merged commit ab2864b into dotnet:main Dec 12, 2024
@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