Skip to content

Tooling implies that _ in member body refers to the instance identifier when it is actually a wildcard pattern #17932

@brianrourkeboll

Description

@brianrourkeboll

When an instance member uses a single underscore _ as its "this" or instance identifier (fsharp/fslang-suggestions#333), the F# tooling implies that any _ pattern used in the member body refers to the instance, even though it does not.

Repro steps

type T () =
    member _.M () =
        fun _ -> ()
        //  ↑ Shows unexpected val _:T on hover.

    member _.N () =
        let _ = () in ()
        //  ↑ Shows unexpected val _:T on hover.

    member this.O () =
        let _ = () in ()
        //  ↑ Shows nothing on hover, as expected.

Expected behavior

Any _ patterns in a member body whose instance identifier is also _ should nonetheless be treated by the tooling like wildcard patterns are in general, and nothing should be shown on hover.

expected.mp4

Actual behavior

Any _ patterns in a member body whose instance identifier is also _ are treated by the tooling as though they refer to the instance identifier.

unexpected.mp4

Known workarounds

N/A.

Related information

Applies to VS and VS Code, .NET 8 and 9 (and probably earlier?).

Metadata

Metadata

Assignees

Labels

Area-LangService-ToolTipstooltips/hover/quickinfoBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.

Type

No fields configured for Bug.

Projects

Status

New

Relationships

None yet

Development

No branches or pull requests

Issue actions