-
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
Do not offer use-conditional when it would cause name collisions #76807
base: main
Are you sure you want to change the base?
Do not offer use-conditional when it would cause name collisions #76807
Conversation
src/Analyzers/CSharp/Analyzers/UseDeconstruction/CSharpUseDeconstructionDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
…nstructionDiagnosticAnalyzer.cs
// Ignore an anonymous type property or tuple field. It's ok if they have a name that | ||
// matches the name of the local we're introducing. | ||
return semanticModel.GetAllDeclaredSymbols(container, cancellationToken, descendInto) | ||
.Where(s => !s.IsAnonymousTypeProperty() && !s.IsTupleField()); |
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 moved this filtering into GetAllDeclaredSymbols as all callers want this behavior.
// matches the name of the local we're introducing. | ||
return semanticModel.GetAllDeclaredSymbols(container, cancellationToken) | ||
.Where(s => !s.IsAnonymousTypeProperty() && !s.IsTupleField()); | ||
return semanticModel.GetAllDeclaredSymbols(container, cancellationToken); |
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.
these checks moved into GetAllDeclaredSymbols .
@JoeRobich @ToddGrun This is ready for review, and is the last open bug in the 'use conditional expr' area. |
Fixes #72464
Followup to #76798