You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The text was updated successfully, but these errors were encountered:
Updated the example, since a single _ parameter is not actually a discard.
Some random thoughts after playing with https://wengier.com/DecompilationDiffer/, I can see how in theory we could allow updating a parameter name to a discard by simple not issuing an edit to the method signature, just the body, and that might work. From experience when I worked on using statements, signatures are still considered when emitting the difference, even without edits, though that might not be true for private classes. Easy enough to verify though.
For going the other way, or if the above doesn't hold, I'm not sure how we can "just use the previous names" as that would mean giving the compiler different trees, which seems odd to me but I haven't looked at how that actually happens so maybe its not as odd as it seems.
Version Used:
Steps to Reproduce:
F5 and update:
to
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).
The text was updated successfully, but these errors were encountered: