[Diagnostics] Better error message for conversion of fun to System.Func
Open
Area-Diagnostics
Feature Improvement
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
The general rule of thumb when interoping with C# is that methods in C# are tupled in F#... except when you try to create a new System.Func.
Example:
```F#
open System
// Error:
// [FS0001] Type mismatch. Expecting a
// 'string -> int -> string * int'
// but given a
// ''a * 'b -> 'a * 'b'
//The type 'string' does not match the type ''a * 'b'
let func : Func =
let f (s,i) = (s,i)
Func(f)
// Ok
let func : Func =
let f s i = (s,i)
Func(f)
```
In the spirit of the "elmish" error message improvements a few months ago, it would be awesome if the compiler could detect this case and give explicit instructions how to resolve this.
Contributor guide
Assessment
This issue has not been assessed yet.