-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
4 - In ReviewA fix for the issue is submitted for review.A fix for the issue is submitted for review.Area-InteractiveBugInteractive-EnC
Milestone
Description
Version Used:
Steps to Reproduce:
F5 and update:
class Program
{
static void Main(string[] args)
{
var x = new Func<int, int, int>((a, b) => a + b + 1);
Console.Write(x(1, 2)); // breakpoint here
}
}to
class Program
{
static void Main(string[] args)
{
var x = new Func<int, int, int>((_, _) => 10);
Console.Write(x(1, 2));
}
}Expected Behavior:
The lambda body is matched to the previous one and is updated to return 10. Program prints 10.
Actual Behavior:
The lambdas are not matched, the program prints 2.
See https://github.com/dotnet/csharplang/blob/master/proposals/csharp-9.0/lambda-discard-parameters.md for all forms of discard lambda parameters.
It should also be possible to update discard to named parameter and to change parameter names.
The CLR likely does not support changing IL method parameter names - but we could just ruse the previous names since the method implementing the lambda body is generated and the parameter names do not matter (other than for reflection).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
4 - In ReviewA fix for the issue is submitted for review.A fix for the issue is submitted for review.Area-InteractiveBugInteractive-EnC