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
Expected Behavior:
The code compiles. nameof(_) references the parameter int _ since lambda parameters are discards and not actual elements.
Note that _ in the lambda body correctly binds to int _ and doesn't consider discard elements
Actual Behavior:
Incorrect and strangely worded error is reported: error CS0229: Ambiguity between 'string' and 'string'
Notes:
Note that this is also a breaking change as the same code compiles with C# 10. It's a small one and in line with other breaking changes caused by parameter scope changes, but given that here it doesn't bring any new functionality it seems avoidable.
The text was updated successfully, but these errors were encountered:
Version Used:
Steps to Reproduce:
Compile the following code with preview language version.
Expected Behavior:
The code compiles.
nameof(_)
references the parameterint _
since lambda parameters are discards and not actual elements.Note that
_
in the lambda body correctly binds toint _
and doesn't consider discard elementsActual Behavior:
Incorrect and strangely worded error is reported:
error CS0229: Ambiguity between 'string' and 'string'
Notes:
Note that this is also a breaking change as the same code compiles with C# 10. It's a small one and in line with other breaking changes caused by parameter scope changes, but given that here it doesn't bring any new functionality it seems avoidable.
The text was updated successfully, but these errors were encountered: