Tooltip shows wrong name resolution on uncallable static member due to name collision
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
```fsharp
module Dom =
type WindowDelimiter =
| WindowDelimiter of int
static member FromCs (a: obj) = WindowDelimiter 1
type Tree =
| WindowDelimiter of WindowDelimiter
static member FromCs (a: obj) = WindowDelimiter(WindowDelimiter.WindowDelimiter(1))
let a = Dom.WindowDelimiter.FromCs null
```
**Expected behavior**
The last line should be OK, even the tooling shows the method in auto-complete, the signature is on the type tooltip, and the member definition highlights when the carret is on the invocation.
**Actual behavior**
> The field , constructor or member 'FromCs' is not defined
**Known workarounds**
@gusty pointed that SRTP trait call enables calling the member.
```fsharp
let inline fromCs< ^t when ^t : (static member FromCs : obj -> ^t)> (x:obj) =
(^t : (static member FromCs : obj -> 't) (x) )
let a = fromCs null
```
Another work around involve putting `RequireQualifiedAccess` which is not always possible / wanted.
**Related information**
Visual Studio 16.5.2
https://github.com/dotnet/fsharp/pull/6805#issuecomment-578721290 => a case where SRTP is useful to work around a compiler limitation.
Contributor guide
Assessment
This issue has not been assessed yet.