-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Resolve extension members in all non-invocation contexts #73239
Changes from 1 commit
bba7662
e13078b
a5d2a0b
7ae3ae9
f4f96c6
f33ffce
db623f9
0b41777
b523dc2
a942cc4
28770c1
e5ac37e
5770a19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -721,14 +721,15 @@ private bool HasApplicableMemberWithPossiblyExpandedNonArrayParamsCollection<TMe | |
(analyzedArguments.HasDynamicArgument ? OverloadResolution.Options.DynamicResolution : OverloadResolution.Options.None)); | ||
diagnostics.Add(expression, useSiteInfo); | ||
|
||
if (resolution.IsExtensionMember(out Symbol extensionMember)) | ||
if (resolution.IsNonMethodExtensionMember(out Symbol extensionMember)) | ||
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. 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. Yes, we can still get here. Below is an example.
|
||
{ | ||
diagnostics.AddRange(resolution.Diagnostics); | ||
var extensionMemberAccess = GetExtensionMemberAccess(expression, methodGroup.ReceiverOpt, extensionMember, | ||
methodGroup.TypeArgumentsSyntax, methodGroup.TypeArgumentsOpt, diagnostics); | ||
|
||
Debug.Assert(extensionMemberAccess.Kind != BoundKind.MethodGroup); | ||
|
||
extensionMemberAccess = CheckValue(extensionMemberAccess, BindValueKind.RValue, diagnostics); | ||
var extensionMemberInvocation = BindInvocationExpression(syntax, expression, methodName, extensionMemberAccess, analyzedArguments, diagnostics); | ||
anyApplicableCandidates = !extensionMemberInvocation.HasAnyErrors; | ||
return extensionMemberInvocation; | ||
|
@@ -2372,7 +2373,6 @@ private BoundExpression BindNameofOperatorInternal(InvocationExpressionSyntax no | |
CheckFeatureAvailability(node, MessageID.IDS_FeatureNameof, diagnostics); | ||
var argument = node.ArgumentList.Arguments[0].Expression; | ||
var boundArgument = BindExpression(argument, diagnostics); | ||
boundArgument = ResolveToExtensionMemberIfPossible(boundArgument, diagnostics); | ||
|
||
bool syntaxIsOk = CheckSyntaxForNameofArgument(argument, out string name, boundArgument.HasAnyErrors ? BindingDiagnosticBag.Discarded : diagnostics); | ||
if (!boundArgument.HasAnyErrors && syntaxIsOk && boundArgument.Kind == BoundKind.MethodGroup) | ||
|
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.
Is the name somewhat confusing? We may still resolve to methods, right? #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.
Maybe I didn't quite understand the question.
ResolveToNonMethodExtensionMemberIfPossible
only returns non-methods.