dotnet / dotnet/fsharp

Tooltip in IDE suggests wrong type of parameter or even multiple types

Open
#17,036 2 comments 1 reaction 0 assignees View on GitHub
Area-FCS Bug Impact-Medium
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

**Repro steps**

```fsharp
type U1 = { Name: string }
type U2 = { Age: int; Name: string }

let test =
seq string> {
fun u -> u.Name
}
|> Seq.map (fun (f: U1 -> string) -> [| f |])
```

1. Hover over `u` parameter. Tooltip says that it's type is `U2` but it is `U1` actually.

![2024-04-11_203434](https://github.com/dotnet/fsharp/assets/44954031/7ca3e4f3-b364-4f38-ad77-fd45eade2091)

2. Also, for `.Name`-part tooltip shows both types U1 and U2. I would expect to see only one type.

![2024-04-11_203445](https://github.com/dotnet/fsharp/assets/44954031/9a6009f5-e55d-46de-8253-dfaf6a4414b6)

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.