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
Labels
Area-LangService-ToolTips tooltips/hover/quickinfo Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone

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

@github-actions github-actions bot added this to the Backlog milestone Oct 28, 2024
@abonie abonie added Area-LangService-ToolTips tooltips/hover/quickinfo Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code. and removed Needs-Triage labels Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-LangService-ToolTips tooltips/hover/quickinfo Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Projects
Status: New
Development

No branches or pull requests

2 participants