-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Ensure local function invocations and method references always have null receivers #56395
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
base: main
Are you sure you want to change the base?
Conversation
…ull receivers Fixes dotnet#51715.
@AlekseyTs, so it turns out that the IDE is depending on the current behavior of IOperation here, as the bootstrap build is now failing. |
It feels like that (IDE) should be fixed. |
|
||
// Local functions are not invoked on receivers from a language point of view, and thus we do not expose | ||
// a receiver for them. | ||
if (symbol is MethodSymbol { MethodKind: MethodKind.LocalFunction }) |
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.
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 guess we are doing this for regular static methods too
[Theory, WorkItem(51715, "https://github.com/dotnet/roslyn/issues/51715")] | ||
[InlineData("static")] | ||
[InlineData("")] | ||
public void Invocation_LocalFunction_01(string modifier) |
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.
@@ -305,5 +305,89 @@ void M(C c1, C c2, System.Func<int> m1, System.Func<int> m2) | |||
|
|||
VerifyFlowGraphAndDiagnosticsForTest<BlockSyntax>(source, expectedFlowGraph, expectedDiagnostics); | |||
} | |||
|
|||
[Fact, WorkItem(51715, "https://github.com/dotnet/roslyn/issues/51715")] | |||
public void MethodReference_LocalFunction_01() |
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.
Same comment as for the invocation tests.
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.
LGTM (commit 1), modulo suggested additional tests
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.
LGTM Thanks (iteration 1)
Fixes #51715.