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

Add FAR support for finding 'Add' methods used in collection initializers. #66700

Merged
merged 3 commits into from
Feb 3, 2023

Conversation

CyrusNajmabadi
Copy link
Member

Fixes #22449

@@ -121,7 +134,12 @@ private static bool IsGetAwaiterMethod(IMethodSymbol methodSymbol)

var suppressionReferences = await FindReferencesInDocumentInsideGlobalSuppressionsAsync(
symbol, state, cancellationToken).ConfigureAwait(false);
return nameMatches.Concat(forEachMatches, deconstructMatches, getAwaiterMatches, suppressionReferences);

var addMatches = IsAddMethod(symbol)
Copy link
Member

Choose a reason for hiding this comment

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

not entirely related to this PR, but do we already support object initializers?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes we do. Those are normal identifier references, so they fall out of normal searches. collection-initializers are an interesting duck where the 'Add' methods are implicitly referenced and need to be specially found.

@CyrusNajmabadi CyrusNajmabadi merged commit 423f682 into dotnet:main Feb 3, 2023
@CyrusNajmabadi CyrusNajmabadi deleted the farCollectionInitializer branch February 3, 2023 21:21
@ghost ghost added this to the Next milestone Feb 3, 2023
@RikkiGibson RikkiGibson modified the milestones: Next, 17.6 P2 Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Find references" ignores collection element initializers
3 participants