Skip to content

Analyze flow in receiver of extension method group in delegate creation #60093

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 4 commits into from
Mar 16, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1533,8 +1533,8 @@ public override BoundNode VisitDelegateCreationExpression(BoundDelegateCreationE

static bool ignoreReceiver(BoundExpression receiver, MethodSymbol method)
{
// ignore the implicit `this` receiver on a static method
return method.IsStatic && receiver is { Kind: BoundKind.ThisReference, WasCompilerGenerated: true };
// static methods that aren't extensions get an implicit `this` receiver that should be ignored
Copy link
Member

Choose a reason for hiding this comment

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

Do we have a test for an extension method called in non-reduced form? It may not be very meaningful since I think this would either have no receiver or have a type expression as a receiver, but thought I would check anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

the static method itself doesn't get an implicit receiver - but the methodgroup...

return method.IsStatic && !method.IsExtensionMethod;
}
}

Expand Down