Skip to content

Commit 201b53e

Browse files
T-GroCopilot
andcommitted
Add tests for named indexed properties with parameters
Address review feedback: add explicit tests for named indexed properties (properties with parameters) to verify they are correctly tagged as Property in tooltips. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ce94dd6 commit 201b53e

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,3 +699,24 @@ type T() =
699699
static member Defaul{caret}t = T()
700700
"""
701701
|> assertNameTagInTooltip TextTag.Property "Default"
702+
703+
// https://github.com/dotnet/fsharp/issues/10540
704+
[<Fact>]
705+
let ``Named indexed property with getter should be tagged as Property`` () =
706+
Checker.getTooltip """
707+
type T() =
708+
member x.Valu{caret}e with get(key: string) = key
709+
"""
710+
|> assertNameTagInTooltip TextTag.Property "Value"
711+
712+
// https://github.com/dotnet/fsharp/issues/10540
713+
[<Fact>]
714+
let ``Named indexed property with getter and setter should be tagged as Property`` () =
715+
Checker.getTooltip """
716+
type T() =
717+
let mutable store = Map.empty<string, int>
718+
member x.Valu{caret}e
719+
with get(key: string) = store.[key]
720+
and set (key: string) (v: int) = store <- store.Add(key, v)
721+
"""
722+
|> assertNameTagInTooltip TextTag.Property "Value"

0 commit comments

Comments
 (0)