Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
brianrourkeboll opened this issue Oct 28, 2024 · 0 comments

Comments

@brianrourkeboll
Copy link
Contributor

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?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: New
Development

No branches or pull requests

1 participant