dotnet / dotnet/fsharp

`open type T` treated as unused when unqualified extension member on `T` used

Open
#17,629 1 comment 0 reactions 0 assignees View on GitHub
Area-LangService-UnusedOpens Bug Impact-Low
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

See also #17619, but this issue applies to all types.

**Repro steps**

```fsharp
type T =
static member A = 99

[]
module M =
type T with
static member Lol = 3

// Shows as unused; the unused opens analyzer will suggest removing it…
open type T

// …Even though it's used.
let lol = Lol
```

**Expected behavior**

An `open type` declaration should be considered used if an unqualified use of an extension member on the type depends on it.

**Actual behavior**

An `open type` declaration is not considered used even if an unqualified use of an extension member on the type depends on it.

**Known workarounds**

N/A.

**Related information**

.NET 8, 9.

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.