-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Extensions: update semantic model APIs #77619
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d73d99b
Extensions: update semantic model APIs
jcouv 83fe1df
Add public ExtensionParameter API. Fix some issues. Add more tests
jcouv 693d896
Extensions: check constraints on explicit type arguments in semantic …
jcouv 70be557
More receiverType check out of EnumerateAllExtensionMembersInSingleBi…
jcouv 3930175
Address feedback
jcouv 8fad903
Remove TODO
jcouv 72216d8
Fix formatting
jcouv 6317607
Add repro for IDE issue
jcouv e3af843
Don't check constraint in explicit type argument scenario for now
jcouv 95f8dec
Revert "Don't check constraint in explicit type argument scenario for…
jcouv f4d9568
Use type parameter definitions and avoid creating new type maps in ch…
jcouv 14d407d
Add more tests
jcouv d356861
Skip constraint checks when not needed (null TypeSubstitution)
jcouv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,41 +47,15 @@ internal void PopulateWithExtensionMethods( | |
this.PopulateHelper(receiverOpt, resultKind, error); | ||
this.IsExtensionMethodGroup = true; | ||
|
||
PooledHashSet<MethodSymbol> implementationsToShadow = null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 this deduplication between skeleton and implementation method is now handled upstream, in |
||
|
||
if (members.Any(static m => m is MethodSymbol { IsExtensionMethod: true }) && | ||
members.Any(static m => m is MethodSymbol { IsExtensionMethod: false, IsStatic: false })) | ||
{ | ||
implementationsToShadow = PooledHashSet<MethodSymbol>.GetInstance(); | ||
|
||
foreach (var member in members) | ||
{ | ||
if (member is MethodSymbol { IsExtensionMethod: false, IsStatic: false } shadows && | ||
shadows.OriginalDefinition.TryGetCorrespondingExtensionImplementationMethod() is { } toShadow) | ||
{ | ||
implementationsToShadow.Add(toShadow); | ||
} | ||
} | ||
} | ||
|
||
foreach (var member in members) | ||
{ | ||
if (member is MethodSymbol method) | ||
{ | ||
Debug.Assert(method.IsExtensionMethod || method.GetIsNewExtensionMember()); | ||
|
||
// Prefer instance extension declarations vs. their implementations | ||
if (method.IsExtensionMethod && implementationsToShadow?.Remove(method.OriginalDefinition) == true) | ||
{ | ||
continue; | ||
} | ||
|
||
this.Methods.Add(method); | ||
} | ||
} | ||
|
||
implementationsToShadow?.Free(); | ||
|
||
if (!typeArguments.IsDefault) | ||
{ | ||
this.TypeArguments.AddRange(typeArguments); | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Are we testing this code path? #Closed
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.
Yes. The interesting test is
PropertyAccess_NotAmbiguousWithInapplicableMethod