Skip to content

Commit 4b6d4f5

Browse files
T-GroCopilot
andcommitted
Add tests for indexers and properties with parameters in tooltips
Address review feedback: verify that indexers and properties with explicit getters are correctly tagged as Property (not Method) in tooltips. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 69fb367 commit 4b6d4f5

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

tests/FSharp.Compiler.Service.Tests/TooltipTests.fs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,3 +660,33 @@ type Bar() =
660660
member val Fo{caret}o = "bla" with get, set
661661
"""
662662
|> assertNameTagInTooltip TextTag.Property "Foo"
663+
664+
// https://github.com/dotnet/fsharp/issues/10540
665+
[<Fact>]
666+
let ``Indexer should be tagged as Property`` () =
667+
Checker.getTooltip """
668+
type T() =
669+
member x.Ite{caret}m with get(i: int) = i
670+
"""
671+
|> assertNameTagInTooltip TextTag.Property "Item"
672+
673+
// https://github.com/dotnet/fsharp/issues/10540
674+
[<Fact>]
675+
let ``Indexer with getter and setter should be tagged as Property`` () =
676+
Checker.getTooltip """
677+
type T() =
678+
let mutable data = [| 0; 1; 2 |]
679+
member x.Ite{caret}m
680+
with get(i: int) = data.[i]
681+
and set (i: int) (v: int) = data.[i] <- v
682+
"""
683+
|> assertNameTagInTooltip TextTag.Property "Item"
684+
685+
// https://github.com/dotnet/fsharp/issues/10540
686+
[<Fact>]
687+
let ``Property with explicit getter should be tagged as Property`` () =
688+
Checker.getTooltip """
689+
type T() =
690+
member x.Valu{caret}e with get() = 42
691+
"""
692+
|> assertNameTagInTooltip TextTag.Property "Value"

0 commit comments

Comments
 (0)