Skip to content

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

@brianrourkeboll

Description

@brianrourkeboll

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

Repro steps

type T =
    static member A = 99

[<AutoOpen>]
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-LangService-UnusedOpensFCS and VS support for unused opensBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.

    Type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions