From 6e3115e2b13bedb0b01e45c789a34330364fbbc0 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Wed, 16 Nov 2022 14:08:32 +0100 Subject: [PATCH 01/10] Issue investigation && repro --- .../FSharp.Compiler.ComponentTests.fsproj | 1 + .../FSharpChecker/FindReferences.fs | 72 +++++++++++++++++++ .../ProjectGeneration.fs | 35 ++++++++- 3 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index d84f43e1acf..b91a093b94a 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -209,6 +209,7 @@ + %(RelativeDir)\TestSource\%(Filename)%(Extension) diff --git a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs new file mode 100644 index 00000000000..dc565363e2c --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs @@ -0,0 +1,72 @@ +module FSharp.Compiler.ComponentTests.FSharpChecker.FindReferences + +open FSharp.Compiler.CodeAnalysis +open Xunit +open FSharp.Test.ProjectGeneration + +type Occurence = Definition | InType | Use + +let deriveOccurence (su:FSharpSymbolUse) = + if su.IsFromDefinition + then Definition + elif su.IsFromType + then InType + elif su.IsFromUse + then Use + else failwith $"Unexpected type of occurence (for this test), symbolUse = {su}" + +/// https://github.com/dotnet/fsharp/issues/13199 +let reproSourceCode = """ +type MyType() = + member x.DoNothing(d:MyType) = () + +let a = MyType() +let b = new MyType() // alternative syntax +a.DoNothing(b) +""" +let impFile = { sourceFile "First" [] with ExtraSource = reproSourceCode } +let project = SyntheticProject.Create(impFile) + +[] +let ``Finding usage of type via GetUsesOfSymbolInFile should also find it's constructors`` () = + project.Workflow + { + checkFile "First" (fun (typeCheckResult: FSharpCheckFileResults) -> + + let symbolUse = typeCheckResult.GetSymbolUseAtLocation(7, 11, "type MyType() =", ["MyType"]).Value + let references = + typeCheckResult.GetUsesOfSymbolInFile(symbolUse.Symbol) + |> Array.sortBy (fun su -> su.Range.StartLine) + |> Array.map (fun su -> su.Range.StartLine, su.Range.StartColumn, su.Range.EndColumn, deriveOccurence su) + + Assert.Equal<(int*int*int*Occurence)>( + [| 7,5,11,Definition + 8,25,31,InType + 10,8,14,Use + 11,12,18,Use + |],references) ) + } + + +[] +let ``Finding usage of type via FindReference should also find it's constructors`` () = + project.Workflow + { + placeCursor "First" 7 11 "type MyType() =" ["MyType"] + saveFile "First" + findAllReferences "First" (fun (ranges:list) -> + let ranges = + ranges + |> List.sortBy (fun r -> r.StartLine) + |> List.map (fun r -> r.StartLine, r.StartColumn, r.EndColumn) + |> Array.ofSeq + + Assert.Equal<(int*int*int)>( + [| 7,5,11 // Typedef itself + 8,25,31 // Usage within type + 10,8,14 // "a" constructor + 11,12,18 // "b" constructor + |],ranges) ) + + } + diff --git a/tests/FSharp.Test.Utilities/ProjectGeneration.fs b/tests/FSharp.Test.Utilities/ProjectGeneration.fs index 7dd50e28d03..483ec9bb352 100644 --- a/tests/FSharp.Test.Utilities/ProjectGeneration.fs +++ b/tests/FSharp.Test.Utilities/ProjectGeneration.fs @@ -356,7 +356,8 @@ module ProjectOperations = type WorkflowContext = { Project: SyntheticProject - Signatures: Map } + Signatures: Map + Cursor : FSharp.Compiler.CodeAnalysis.FSharpSymbolUse option } type ProjectWorkflowBuilder(initialProject: SyntheticProject, ?checker: FSharpChecker) = @@ -392,7 +393,8 @@ type ProjectWorkflowBuilder(initialProject: SyntheticProject, ?checker: FSharpCh return { Project = initialProject - Signatures = Map signatures } + Signatures = Map signatures + Cursor = None } } member this.Run(workflow: Async) = @@ -442,6 +444,35 @@ type ProjectWorkflowBuilder(initialProject: SyntheticProject, ?checker: FSharpCh return { ctx with Signatures = ctx.Signatures.Add(fileId, newSignature) } } + /// Find a symbol using the provided range, mimicing placing a cursor on it in IDE scenarios + [] + member this.PlaceCursor(workflow: Async, fileId, line, colAtEndOfNames, fullLine, symbolNames) = + async { + let! ctx = workflow + let! results = checkFile fileId ctx.Project checker + let typeCheckResults = getTypeCheckResult results + + let su = typeCheckResults.GetSymbolUseAtLocation(line,colAtEndOfNames,fullLine,symbolNames) + + return {ctx with Cursor = su} + } + + + + /// Find all references within a single file, results are provided to the 'processResults' function + [] + member this.FindAllReferences(workflow: Async, fileId: string, processResults) = + async{ + let! ctx = workflow + let po = ctx.Project.GetProjectOptions checker + let s = ctx.Cursor |> Option.defaultWith (fun () -> failwith "Please place cursor at a valid location via placeCursor first") + let! results = checker.FindBackgroundReferencesInFile(fileId,po, s.Symbol) + + processResults (results |> Seq.toList) + + return ctx + } + /// Parse and type check given file and process the results using `processResults` function. [] member this.CheckFile(workflow: Async, fileId: string, processResults) = From 5148ce0ec9b2f32c4e90ed8da2faaf57db863d34 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Wed, 16 Nov 2022 17:14:39 +0100 Subject: [PATCH 02/10] Abs filepath remapping for test DSL --- .../FSharpChecker/FindReferences.fs | 3 +-- tests/FSharp.Test.Utilities/ProjectGeneration.fs | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs index dc565363e2c..ff6c76a837e 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs +++ b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs @@ -52,8 +52,7 @@ let ``Finding usage of type via GetUsesOfSymbolInFile should also find it's cons let ``Finding usage of type via FindReference should also find it's constructors`` () = project.Workflow { - placeCursor "First" 7 11 "type MyType() =" ["MyType"] - saveFile "First" + placeCursor "First" 7 11 "type MyType() =" ["MyType"] findAllReferences "First" (fun (ranges:list) -> let ranges = ranges diff --git a/tests/FSharp.Test.Utilities/ProjectGeneration.fs b/tests/FSharp.Test.Utilities/ProjectGeneration.fs index 483ec9bb352..14dc3a5610d 100644 --- a/tests/FSharp.Test.Utilities/ProjectGeneration.fs +++ b/tests/FSharp.Test.Utilities/ProjectGeneration.fs @@ -466,7 +466,9 @@ type ProjectWorkflowBuilder(initialProject: SyntheticProject, ?checker: FSharpCh let! ctx = workflow let po = ctx.Project.GetProjectOptions checker let s = ctx.Cursor |> Option.defaultWith (fun () -> failwith "Please place cursor at a valid location via placeCursor first") - let! results = checker.FindBackgroundReferencesInFile(fileId,po, s.Symbol) + let file = ctx.Project.Find fileId + let absFileName = ctx.Project.ProjectDir ++ file.FileName + let! results = checker.FindBackgroundReferencesInFile(absFileName,po, s.Symbol) processResults (results |> Seq.toList) From 84f69ba51fd245b8d18698656d422ea65abbafad Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Wed, 16 Nov 2022 17:22:52 +0100 Subject: [PATCH 03/10] itemKeyStore enabled for test workflow --- .../FSharpChecker/FindReferences.fs | 2 +- tests/FSharp.Test.Utilities/ProjectGeneration.fs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs index ff6c76a837e..94d2bddce58 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs +++ b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs @@ -63,7 +63,7 @@ let ``Finding usage of type via FindReference should also find it's constructors Assert.Equal<(int*int*int)>( [| 7,5,11 // Typedef itself 8,25,31 // Usage within type - 10,8,14 // "a" constructor + //10,8,14 // "a" constructor This is the bug, A should be reported but it is not 11,12,18 // "b" constructor |],ranges) ) diff --git a/tests/FSharp.Test.Utilities/ProjectGeneration.fs b/tests/FSharp.Test.Utilities/ProjectGeneration.fs index 14dc3a5610d..e89c605d4d2 100644 --- a/tests/FSharp.Test.Utilities/ProjectGeneration.fs +++ b/tests/FSharp.Test.Utilities/ProjectGeneration.fs @@ -361,7 +361,7 @@ type WorkflowContext = type ProjectWorkflowBuilder(initialProject: SyntheticProject, ?checker: FSharpChecker) = - let checker = defaultArg checker (FSharpChecker.Create()) + let checker = defaultArg checker (FSharpChecker.Create(enableBackgroundItemKeyStoreAndSemanticClassification=true)) let mapProject f workflow = async { From 8f53d85573fefd803a12de93ada26cb037052abb Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Wed, 16 Nov 2022 18:28:12 +0100 Subject: [PATCH 04/10] Changing behaviour for FindAllReferences and constructors --- src/Compiler/Service/ItemKey.fs | 5 ++++- .../FSharpChecker/FindReferences.fs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Compiler/Service/ItemKey.fs b/src/Compiler/Service/ItemKey.fs index ef769874226..987b969896a 100644 --- a/src/Compiler/Service/ItemKey.fs +++ b/src/Compiler/Service/ItemKey.fs @@ -299,6 +299,8 @@ and [] ItemKeyStoreBuilder() = | Parent eref -> writeEntityRef eref member _.Write(m: range, item: Item) = + if item.DisplayNameCore.Contains("MyType") then + printfn $"item {item.DisplayNameCore} hit" writeRange m let fixup = b.ReserveBytes 4 |> BlobWriter @@ -390,7 +392,8 @@ and [] ItemKeyStoreBuilder() = | Item.MethodGroup (_, [ info ], _) | Item.CtorGroup (_, [ info ]) -> match info with - | FSMeth (_, _, vref, _) -> writeValRef vref + | FSMeth (_, ty, vref, _) when vref.IsConstructor -> writeType true ty + | FSMeth (_, _, vref, _) -> writeValRef vref | ILMeth (_, info, _) -> info.ILMethodRef.ArgTypes |> List.iter writeILType writeILType info.ILMethodRef.ReturnType diff --git a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs index 94d2bddce58..89e54aa9cf8 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs +++ b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs @@ -63,7 +63,7 @@ let ``Finding usage of type via FindReference should also find it's constructors Assert.Equal<(int*int*int)>( [| 7,5,11 // Typedef itself 8,25,31 // Usage within type - //10,8,14 // "a" constructor This is the bug, A should be reported but it is not + 10,8,14 // "a" constructor ===> This is the bug, 'let a = MyType()' should be reported as a reference/renaming target but it is not 11,12,18 // "b" constructor |],ranges) ) From 9c157ee6175e7113a345258c2cfff47945968fb9 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Wed, 16 Nov 2022 21:06:18 +0100 Subject: [PATCH 05/10] tests for strange static init --- .../FSharpChecker/FindReferences.fs | 92 +++++++++++++++++-- 1 file changed, 86 insertions(+), 6 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs index 89e54aa9cf8..5e23e73acb3 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs +++ b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs @@ -21,15 +21,68 @@ type MyType() = member x.DoNothing(d:MyType) = () let a = MyType() -let b = new MyType() // alternative syntax +let b = new MyType() a.DoNothing(b) """ let impFile = { sourceFile "First" [] with ExtraSource = reproSourceCode } -let project = SyntheticProject.Create(impFile) +let createProject() = SyntheticProject.Create(impFile) + +let plainCreation = sourceFile "First" [] +let creationWithWith = { sourceFile "First" [] with ExtraSource = reproSourceCode } +let plainCreationChangedLater = { plainCreation with ExtraSource = reproSourceCode } +let creationviaFunc() = { sourceFile "First" [] with ExtraSource = reproSourceCode } + +let sourceFileLocal = + { Id = "xx" + PublicVersion = 1 + InternalVersion = 1 + DependsOn = [] + FunctionName = "f" + SignatureFile = No + HasErrors = false + ExtraSource = "" + EntryPoint = false } + +let plainLocalCreation = sourceFileLocal +let localCreationWithWith = { sourceFileLocal with ExtraSource = reproSourceCode } +let localCreationChangedLater = { plainCreation with ExtraSource = reproSourceCode } + + +[] +let ``What is happening with static init - plainCreation`` () = + Assert.NotNull(plainCreation) + +[] +let ``What is happening with static init - creationWithWith`` () = + Assert.NotNull(creationWithWith) + +[] +let ``What is happening with static init - plainCreationChangedLater`` () = + Assert.NotNull(plainCreationChangedLater) + +[] +let ``What is happening with static init - impFile`` () = + Assert.NotNull(impFile) + +[] +let ``What is happening with static init - creationviaFunc`` () = + Assert.NotNull(creationviaFunc()) + +[] +let ``What is happening with static init - plainLocalCreation`` () = + Assert.NotNull(plainLocalCreation) + +[] +let ``What is happening with static init - localCreationWithWith`` () = + Assert.NotNull(localCreationWithWith) + +[] +let ``What is happening with static init - localCreationChangedLater`` () = + Assert.NotNull(localCreationChangedLater) [] let ``Finding usage of type via GetUsesOfSymbolInFile should also find it's constructors`` () = - project.Workflow + createProject().Workflow { checkFile "First" (fun (typeCheckResult: FSharpCheckFileResults) -> @@ -50,7 +103,7 @@ let ``Finding usage of type via GetUsesOfSymbolInFile should also find it's cons [] let ``Finding usage of type via FindReference should also find it's constructors`` () = - project.Workflow + createProject().Workflow { placeCursor "First" 7 11 "type MyType() =" ["MyType"] findAllReferences "First" (fun (ranges:list) -> @@ -63,8 +116,35 @@ let ``Finding usage of type via FindReference should also find it's constructors Assert.Equal<(int*int*int)>( [| 7,5,11 // Typedef itself 8,25,31 // Usage within type - 10,8,14 // "a" constructor ===> This is the bug, 'let a = MyType()' should be reported as a reference/renaming target but it is not - 11,12,18 // "b" constructor + 10,8,14 // "a= ..." constructor + 11,12,18 // "b= ..." constructor + |],ranges) ) + + } + +[] +let ``Finding usage of type via FindReference works across files`` () = + let secondFile = { sourceFile "Second" ["First"] with ExtraSource = """ +open ModuleFirst +let secondA = MyType() +let secondB = new MyType() +secondA.DoNothing(secondB) + """} + let original = createProject() + let project = {original with SourceFiles = original.SourceFiles @ [secondFile]} + project.Workflow + { + placeCursor "First" 7 11 "type MyType() =" ["MyType"] + findAllReferences "Second" (fun (ranges:list) -> + let ranges = + ranges + |> List.sortBy (fun r -> r.StartLine) + |> List.map (fun r -> r.StartLine, r.StartColumn, r.EndColumn) + |> Array.ofSeq + + Assert.Equal<(int*int*int)>( + [| 9,14,20 // "secondA = ..." constructor + 10,18,24 // "secondB = ..." constructor |],ranges) ) } From 2f65483c7777ab8f6332b4a093a7246ee0de9870 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 18 Nov 2022 08:25:15 +0100 Subject: [PATCH 06/10] Making tests pass in net70 --- .../FSharpChecker/FindReferences.fs | 57 +------------------ 1 file changed, 2 insertions(+), 55 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs index 5e23e73acb3..48cfdf9168a 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs +++ b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs @@ -24,61 +24,8 @@ let a = MyType() let b = new MyType() a.DoNothing(b) """ -let impFile = { sourceFile "First" [] with ExtraSource = reproSourceCode } -let createProject() = SyntheticProject.Create(impFile) - -let plainCreation = sourceFile "First" [] -let creationWithWith = { sourceFile "First" [] with ExtraSource = reproSourceCode } -let plainCreationChangedLater = { plainCreation with ExtraSource = reproSourceCode } -let creationviaFunc() = { sourceFile "First" [] with ExtraSource = reproSourceCode } - -let sourceFileLocal = - { Id = "xx" - PublicVersion = 1 - InternalVersion = 1 - DependsOn = [] - FunctionName = "f" - SignatureFile = No - HasErrors = false - ExtraSource = "" - EntryPoint = false } - -let plainLocalCreation = sourceFileLocal -let localCreationWithWith = { sourceFileLocal with ExtraSource = reproSourceCode } -let localCreationChangedLater = { plainCreation with ExtraSource = reproSourceCode } - - -[] -let ``What is happening with static init - plainCreation`` () = - Assert.NotNull(plainCreation) - -[] -let ``What is happening with static init - creationWithWith`` () = - Assert.NotNull(creationWithWith) - -[] -let ``What is happening with static init - plainCreationChangedLater`` () = - Assert.NotNull(plainCreationChangedLater) - -[] -let ``What is happening with static init - impFile`` () = - Assert.NotNull(impFile) - -[] -let ``What is happening with static init - creationviaFunc`` () = - Assert.NotNull(creationviaFunc()) - -[] -let ``What is happening with static init - plainLocalCreation`` () = - Assert.NotNull(plainLocalCreation) - -[] -let ``What is happening with static init - localCreationWithWith`` () = - Assert.NotNull(localCreationWithWith) - -[] -let ``What is happening with static init - localCreationChangedLater`` () = - Assert.NotNull(localCreationChangedLater) +let impFile() = { sourceFile "First" [] with ExtraSource = reproSourceCode } +let createProject() = SyntheticProject.Create(impFile()) [] let ``Finding usage of type via GetUsesOfSymbolInFile should also find it's constructors`` () = From c4b49b8936775f6abfba69d9aaa8ec304e273ed1 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 18 Nov 2022 08:31:02 +0100 Subject: [PATCH 07/10] Remove debugging code --- src/Compiler/Service/ItemKey.fs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Compiler/Service/ItemKey.fs b/src/Compiler/Service/ItemKey.fs index 987b969896a..950a87dd5f4 100644 --- a/src/Compiler/Service/ItemKey.fs +++ b/src/Compiler/Service/ItemKey.fs @@ -299,8 +299,6 @@ and [] ItemKeyStoreBuilder() = | Parent eref -> writeEntityRef eref member _.Write(m: range, item: Item) = - if item.DisplayNameCore.Contains("MyType") then - printfn $"item {item.DisplayNameCore} hit" writeRange m let fixup = b.ReserveBytes 4 |> BlobWriter From 4e28226bbc073edac45c91c90fd33a5b6961b36e Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 18 Nov 2022 08:46:41 +0100 Subject: [PATCH 08/10] Reflect VS-realistic FsharpChecker settings in ProjectWorkflowBuilder (for tests) --- tests/FSharp.Test.Utilities/ProjectGeneration.fs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/FSharp.Test.Utilities/ProjectGeneration.fs b/tests/FSharp.Test.Utilities/ProjectGeneration.fs index e89c605d4d2..687e2e4f8d1 100644 --- a/tests/FSharp.Test.Utilities/ProjectGeneration.fs +++ b/tests/FSharp.Test.Utilities/ProjectGeneration.fs @@ -361,7 +361,14 @@ type WorkflowContext = type ProjectWorkflowBuilder(initialProject: SyntheticProject, ?checker: FSharpChecker) = - let checker = defaultArg checker (FSharpChecker.Create(enableBackgroundItemKeyStoreAndSemanticClassification=true)) + let checker = + defaultArg + checker + (FSharpChecker.Create( + keepAllBackgroundSymbolUses = false, + enableBackgroundItemKeyStoreAndSemanticClassification = true, + enablePartialTypeChecking = true + )) let mapProject f workflow = async { From 265b0cf1fb5841c231be9ad6f64ba14d273619ab Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 18 Nov 2022 08:50:20 +0100 Subject: [PATCH 09/10] Fantomas applied --- src/Compiler/Service/ItemKey.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Compiler/Service/ItemKey.fs b/src/Compiler/Service/ItemKey.fs index 950a87dd5f4..9609ccf9c38 100644 --- a/src/Compiler/Service/ItemKey.fs +++ b/src/Compiler/Service/ItemKey.fs @@ -390,8 +390,8 @@ and [] ItemKeyStoreBuilder() = | Item.MethodGroup (_, [ info ], _) | Item.CtorGroup (_, [ info ]) -> match info with - | FSMeth (_, ty, vref, _) when vref.IsConstructor -> writeType true ty - | FSMeth (_, _, vref, _) -> writeValRef vref + | FSMeth (_, ty, vref, _) when vref.IsConstructor -> writeType true ty + | FSMeth (_, _, vref, _) -> writeValRef vref | ILMeth (_, info, _) -> info.ILMethodRef.ArgTypes |> List.iter writeILType writeILType info.ILMethodRef.ReturnType From 434d80728c56a62cba8e5619629db9237a70d1f4 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Mon, 21 Nov 2022 11:31:31 +0000 Subject: [PATCH 10/10] PR feedback --- tests/FSharp.Test.Utilities/ProjectGeneration.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/FSharp.Test.Utilities/ProjectGeneration.fs b/tests/FSharp.Test.Utilities/ProjectGeneration.fs index 687e2e4f8d1..c565ca9b779 100644 --- a/tests/FSharp.Test.Utilities/ProjectGeneration.fs +++ b/tests/FSharp.Test.Utilities/ProjectGeneration.fs @@ -472,7 +472,7 @@ type ProjectWorkflowBuilder(initialProject: SyntheticProject, ?checker: FSharpCh async{ let! ctx = workflow let po = ctx.Project.GetProjectOptions checker - let s = ctx.Cursor |> Option.defaultWith (fun () -> failwith "Please place cursor at a valid location via placeCursor first") + let s = ctx.Cursor |> Option.defaultWith (fun () -> failwith $"Please place cursor at a valid location via {nameof(this.PlaceCursor)} first") let file = ctx.Project.Find fileId let absFileName = ctx.Project.ProjectDir ++ file.FileName let! results = checker.FindBackgroundReferencesInFile(absFileName,po, s.Symbol)