From 935aef383e84bacf08ca8a4ad7ae7b7577897d1b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 18 May 2026 11:22:43 +0000 Subject: [PATCH 1/5] Initial plan From c16879d9342551dbcb3e25e3f5e8de6dc2d2fc8c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 18 May 2026 11:41:51 +0000 Subject: [PATCH 2/5] fix: suppress underscore wildcard hover resolution in members Agent-Logs-Url: https://github.com/dotnet/fsharp/sessions/54b93d4d-8821-44a9-8d0e-e45addc62be1 Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com> --- src/Compiler/Service/FSharpCheckerResults.fs | 7 +++++++ .../TooltipTests.fs | 21 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index 6e9c1ced07..c8f12b2512 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -1631,11 +1631,18 @@ type internal TypeCheckInfo | None -> ValueNone | _ -> ValueNone + let isDiscardIdentifier = + match residueOpt, origLongIdentOpt with + | None, Some [ "_" ] -> true + | _ -> false + match nameResItems with | NameResResult.Cancel(denv, m) -> Some([], denv, m) | NameResResult.Members(FilterRelevantItems getItem exactMatchResidueOpt (items, denv, m)) -> // lookup based on name resolution results successful Some(items |> List.map (CompletionItem (getType ()) ValueNone), denv, m) + | _ when isDiscardIdentifier -> + None | _ -> match origLongIdentOpt with | None -> None diff --git a/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs b/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs index 2947e09f56..7695c9f42f 100644 --- a/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs @@ -399,6 +399,9 @@ let assertNameTagInTooltip expectedTag expectedName (tooltip: ToolTipText) = let desc = tags |> Array.map (fun t -> sprintf "(%A, %s)" t.Tag t.Text) |> String.concat ", " Assert.True(found, sprintf "Expected tag %A with text '%s' in tooltip, but found: %s" expectedTag expectedName desc) +let assertToolTipIsEmpty (ToolTipText(items)) = + Assert.Empty items + let normalize (s: string) = s.Replace("\r\n", "\n").Replace("\n\n", "\n") [] @@ -594,6 +597,24 @@ let y = normaliz{caret}e' 5 |> assertAndGetSingleToolTipText |> Assert.shouldBeEquivalentTo "val normalize': x: int -> int" +[] +let ``Wildcard lambda parameter inside member with underscore instance identifier has no tooltip`` () = + Checker.getTooltip """ +type T () = + member _.M () = + fun _{caret} -> () +""" + |> assertToolTipIsEmpty + +[] +let ``Wildcard let binding inside member with underscore instance identifier has no tooltip`` () = + Checker.getTooltip """ +type T () = + member _.N () = + let _{caret} = () in () +""" + |> assertToolTipIsEmpty + // https://github.com/dotnet/fsharp/issues/13194 [] let ``Sig file XML doc fallback works for member whose name contains a single quote`` () = From 1ab81e1259852d009757b4ede83658963265c2de Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 18 May 2026 12:06:24 +0000 Subject: [PATCH 3/5] style: apply final formatting for wildcard hover fix Agent-Logs-Url: https://github.com/dotnet/fsharp/sessions/54b93d4d-8821-44a9-8d0e-e45addc62be1 Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com> --- src/Compiler/Service/FSharpCheckerResults.fs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index c8f12b2512..76b8514d8e 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -1641,8 +1641,7 @@ type internal TypeCheckInfo | NameResResult.Members(FilterRelevantItems getItem exactMatchResidueOpt (items, denv, m)) -> // lookup based on name resolution results successful Some(items |> List.map (CompletionItem (getType ()) ValueNone), denv, m) - | _ when isDiscardIdentifier -> - None + | _ when isDiscardIdentifier -> None | _ -> match origLongIdentOpt with | None -> None From f9eded01b1f6500ff5dc3f76e828604b812f82e8 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Mon, 25 May 2026 14:16:44 +0200 Subject: [PATCH 4/5] Address review feedback: add inline comment and additional tests - Add explanatory comment above the isDiscardIdentifier guard - Add test for match wildcard pattern inside member _.M() body - Add negative test confirming named self-identifier (this) is unaffected Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Compiler/Service/FSharpCheckerResults.fs | 1 + .../TooltipTests.fs | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index 76b8514d8e..271d9ae25e 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -1631,6 +1631,7 @@ type internal TypeCheckInfo | None -> ValueNone | _ -> ValueNone + // Wildcard _ should not resolve to the member's synthetic self-identifier via fallback. let isDiscardIdentifier = match residueOpt, origLongIdentOpt with | None, Some [ "_" ] -> true diff --git a/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs b/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs index 7695c9f42f..9742daf0bf 100644 --- a/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/TooltipTests.fs @@ -615,6 +615,25 @@ type T () = """ |> assertToolTipIsEmpty +[] +let ``Wildcard match pattern inside member with underscore instance identifier has no tooltip`` () = + Checker.getTooltip """ +type T () = + member _.M (x: int) = + match x with + | _{caret} -> () +""" + |> assertToolTipIsEmpty + +[] +let ``Named self-identifier is not affected by wildcard discard fix`` () = + Checker.getTooltip """ +type T () = + member thi{caret}s.M () = () +""" + |> assertAndGetSingleToolTipText + |> Assert.shouldContain "T" + // https://github.com/dotnet/fsharp/issues/13194 [] let ``Sig file XML doc fallback works for member whose name contains a single quote`` () = From 190129b5da53e8556953163ccd63156b4768a2e0 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Mon, 25 May 2026 15:59:07 +0200 Subject: [PATCH 5/5] Add release notes for wildcard hover fix Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/release-notes/.FSharp.Compiler.Service/11.0.100.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md index 7d4162f804..8e55f0e3b6 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -1,5 +1,6 @@ ### Fixed +* Suppress hover/symbol resolution for wildcard `_` patterns inside `member _.…` bodies that incorrectly showed `val _: T` tooltip. ([PR #19760](https://github.com/dotnet/fsharp/pull/19760)) * Honor `--nowarn` and `--warnaserror` for warnings emitted during command-line option parsing ([Issue #19576](https://github.com/dotnet/fsharp/issues/19576), [PR #19776](https://github.com/dotnet/fsharp/pull/19776)) * Fix `[]` prefix attributes being silently dropped on class members, and fix false-positive `AllowMultiple=false` errors when `[]` and `[]` are applied to the same binding. ([Issue #17904](https://github.com/dotnet/fsharp/issues/17904), [Issue #19020](https://github.com/dotnet/fsharp/issues/19020), [PR #19738](https://github.com/dotnet/fsharp/pull/19738)) * Fix attributes on return type of unparenthesized tuple methods being silently dropped from IL. ([Issue #462](https://github.com/dotnet/fsharp/issues/462), [PR #19714](https://github.com/dotnet/fsharp/pull/19714))