-
Notifications
You must be signed in to change notification settings - Fork 804
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
Bugfix - underscore dot lambda conversion to Func<> in LINQ #16339
Bugfix - underscore dot lambda conversion to Func<> in LINQ #16339
Conversation
…pe-inference-error-in-shorthand-lambda
Wouldn't this fix also allow conversion between a short lambda and |
It should, let me add a simple test for that as well. |
@DedSec256 Do you have a sample to add a test? |
open System
open System.Linq.Expressions
type A = static member M(x: Expression<Func<string, int>>) = ()
A.M(fun x -> x.Length)
A.M(_.Length)
Should we allow such a conversion? Will it be able to convert the F# expression into a tree at runtime? |
It should be the same as the existing behaviour for the existing lambda expressions. 🙂 |
Confirmed, it works. |
Also it works without parens when using underscore dot lambda. |
I've done some testing with SDK 8.0.101, and while it works with
|
Fixes #16305
This changes how dot lambda is being recognized for type inference, making sure it is treated like a function type.
With that, it will be detected in method call scenarios for a possible conversion between function type to
Func<,>
.The following three now work (before, only the first did):