Tooltip in IDE suggests wrong type of parameter or even multiple types
Repro steps
type U1 = { Name: string }
type U2 = { Age: int; Name: string }
let test =
seq<U1 -> string> {
fun u -> u.Name
}
|> Seq.map (fun (f: U1 -> string) -> [| f |])
- Hover over
uparameter. Tooltip says that it's type isU2but it isU1actually.
- Also, for
.Name-part tooltip shows both types U1 and U2. I would expect to see only one type.
As far as I can see code compiles and runs correctly without runtime errors, IL doesn't mention U2 type besides declaration.
I suspect these problems are related but tell me if I should create separate issue for each one :)
Related information
- .NET SDK 8.0.204
- VS 17.9.6 and also Rider 2024.1, probably not specific to IDE.
The same thing also shows with Ionide in VS Code:
https://github.com/dotnet/fsharp/assets/14795984/ecb072fd-ad85-49a8-9bd9-cd54e6810ca8
Noticed that the same code fails to compile with 7.0.202 SDK. Compiler treats u as U2 and doesn't see seq<U1 -> string> when deducing:
Error FS0193 : Type constraint mismatch. The type
'U2 -> string'
is not compatible with type
'U1 -> string'
Really hope that it's not a regression, I don't want to write fun (u: U1) -> u.Name again in the future :laughing: