diff --git a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs index b05096303d4..6dcd6463cd5 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs +++ b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs @@ -51,7 +51,7 @@ let internal recordAllEvents groupBy = let getFileNameKey (_l, (f: string, _p), _) = Path.GetFileName f // TODO: currently the label for DependecyGraph cache is $"%d{fileSnapshots.Length} files ending with {lastFile}" -let getDependecyGraphKey (_l, _, _) = failwith "not implemented" +let getDependecyGraphKey (_l, _, _) = failwith "not implemented" let internal recordEvents groupBy = let observe, getEvents = recordAllEvents groupBy @@ -293,7 +293,7 @@ let ``We don't check files that are not depended on`` () = let observe, check = recordEvents getFileNameKey - ProjectWorkflowBuilder(project, useTransparentCompiler = true) { + ProjectWorkflowBuilder(project, useTransparentCompiler = true) { withChecker (observe _.TcIntermediate) updateFile "First" updatePublicSurface checkFile "Last" expectOk @@ -448,7 +448,7 @@ let fuzzingTest seed (project: SyntheticProject) = task { let builder = ProjectWorkflowBuilder(project, useTransparentCompiler = true, autoStart = false) let checker = builder.Checker - + // Force creation and caching of options do! SaveAndCheckProject project checker false |> Async.Ignore @@ -600,7 +600,7 @@ let fuzzingTest seed (project: SyntheticProject) = task { builder.DeleteProjectDir() } -[] +[] [] [] [] @@ -712,7 +712,7 @@ let ``What happens if bootstrapInfoStatic needs to be recomputed`` _ = giraffeProject.Workflow { updateFile "Helpers" (fun f -> { f with SignatureFile = Custom (f.SignatureFile.CustomText + "\n") }) checkFile "EndpointRouting" expectOk - withChecker (fun checker -> + withChecker (fun checker -> async { checker.Caches.BootstrapInfoStatic.Clear() checker.Caches.BootstrapInfo.Clear() @@ -722,7 +722,7 @@ let ``What happens if bootstrapInfoStatic needs to be recomputed`` _ = }) updateFile "Core" (fun f -> { f with SignatureFile = Custom (f.SignatureFile.CustomText + "\n") }) checkFile "EndpointRouting" expectOk - } + } module ParsedInputHashing = @@ -776,7 +776,7 @@ let ``TypeCheck last file in project with transparent compiler`` useTransparentC let responseFile = FileInfo responseFile let syntheticProject = mkSyntheticProjectForResponseFile responseFile - let workflow = + let workflow = ProjectWorkflowBuilder( syntheticProject, isExistingProject = true, @@ -793,7 +793,7 @@ let ``TypeCheck last file in project with transparent compiler`` useTransparentC | Some lastFile -> workflow { - clearCache + clearCache checkFile lastFile expectOk } @@ -803,13 +803,13 @@ let ``LoadClosure for script is computed once`` () = sourceFile "First" []) let observe, getEvents = recordAllEvents getFileNameKey - + ProjectWorkflowBuilder(project, useTransparentCompiler = true) { withChecker (observe _.ScriptClosure) checkFile "First" expectOk } |> ignore - + Assert.Empty(getEvents()) [] @@ -819,7 +819,7 @@ let ``LoadClosure for script is recomputed after changes`` () = sourceFile "First" []) let observe, check = recordEvents getFileNameKey - + ProjectWorkflowBuilder(project, useTransparentCompiler = true) { withChecker (observe _.ScriptClosure) checkFile "First" expectOk @@ -830,12 +830,12 @@ let ``LoadClosure for script is recomputed after changes`` () = } |> ignore check (fileName "First") [Weakened; Requested; Started; Finished; Weakened; Requested; Started; Finished] - + [] let ``TryGetRecentCheckResultsForFile returns None before first call to ParseAndCheckFileInProject`` () = let project = SyntheticProject.Create( sourceFile "First" []) - + ProjectWorkflowBuilder(project) { clearCache tryGetRecentCheckResults "First" expectNone @@ -845,7 +845,7 @@ let ``TryGetRecentCheckResultsForFile returns None before first call to ParseAnd let ``TryGetRecentCheckResultsForFile returns result after first call to ParseAndCheckFileInProject`` () = let project = SyntheticProject.Create( sourceFile "First" [] ) - + ProjectWorkflowBuilder(project) { tryGetRecentCheckResults "First" expectSome } |> ignore @@ -854,7 +854,7 @@ let ``TryGetRecentCheckResultsForFile returns result after first call to ParseAn let ``TryGetRecentCheckResultsForFile returns no result after edit`` () = let project = SyntheticProject.Create( sourceFile "First" []) - + ProjectWorkflowBuilder(project) { tryGetRecentCheckResults "First" expectSome updateFile "First" updatePublicSurface @@ -862,13 +862,13 @@ let ``TryGetRecentCheckResultsForFile returns no result after edit`` () = checkFile "First" expectOk tryGetRecentCheckResults "First" expectSome } |> ignore - + [] let ``TryGetRecentCheckResultsForFile returns result after edit of other file`` () = let project = SyntheticProject.Create( sourceFile "First" [], sourceFile "Second" ["First"]) - + ProjectWorkflowBuilder(project) { tryGetRecentCheckResults "First" expectSome tryGetRecentCheckResults "Second" expectSome @@ -901,7 +901,7 @@ let ``Unused warning should still produce after parse warning`` useTransparentCo // There should be parse warning because of the space in the file name: // warning FS0221: The declarations in this file will be placed in an implicit module 'As 01' based on the file name 'As 01.fs'. // However this is not a valid F# identifier, so the contents will not be accessible from other files. Consider renaming the file or adding a 'module' or 'namespace' declaration at the top of the file. - + let project = { SyntheticProject.Create( { sourceFile "As 01" [] with @@ -914,7 +914,7 @@ do printfn "Hello from F#" """ SignatureFile = No - + }) with AutoAddModules = false OtherOptions = [ @@ -939,7 +939,7 @@ printfn "Hello from F#" checkResults.Diagnostics |> Array.exists (fun diag -> diag.Severity = FSharpDiagnosticSeverity.Warning && diag.ErrorNumber = 1182) Assert.True(hasCheckWarning, "Expected post inference warning FS1182") - + ProjectWorkflowBuilder(project, useTransparentCompiler = useTransparentCompiler) { checkFile "As 01" expectTwoWarnings } @@ -959,12 +959,12 @@ type private LoadClosureTestShim(currentFileSystem: IFileSystem) = let mutable bDidUpdate = false let asStream (v:string) = new MemoryStream(System.Text.Encoding.UTF8.GetBytes v) let knownFiles = set [ "a.fsx"; "b.fsx"; "c.fsx" ] - + member val aFsx = "#load \"b.fsx\"" member val bFsxInitial = "" member val bFsxUpdate = "#load \"c.fsx\"" member val cFsx = "" - + member x.DocumentSource (fileName: string) = async { if not (knownFiles.Contains fileName) then @@ -978,7 +978,7 @@ type private LoadClosureTestShim(currentFileSystem: IFileSystem) = } member x.UpdateB () = bDidUpdate <- true - + override _.FileExistsShim(path) = if knownFiles.Contains path then true else currentFileSystem.FileExistsShim(path) override _.GetFullPathShim(fileName) = @@ -996,7 +996,7 @@ type private LoadClosureTestShim(currentFileSystem: IFileSystem) = ) module TestsMutatingFileSystem = - + [] [] [] @@ -1010,7 +1010,7 @@ module TestsMutatingFileSystem = if System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework") then None else - Some false + Some false try let checker = FSharpChecker.Create(useTransparentCompiler = useTransparentCompiler) @@ -1034,7 +1034,7 @@ module TestsMutatingFileSystem = match snd checkResults with | FSharpCheckFileAnswer.Aborted -> failwith "Did not expected FSharpCheckFileAnswer.Aborted" | FSharpCheckFileAnswer.Succeeded checkFileResults -> Assert.Equal(0, checkFileResults.Diagnostics.Length) - + // Update b.fsx, it should now load c.fsx fileSystemShim.UpdateB() @@ -1081,7 +1081,7 @@ let ``Parsing with cache and without project snapshot`` () = async { let checker = FSharpChecker.Create(useTransparentCompiler = true) let fileName = "B.fs" - let parsingOptions = { FSharpParsingOptions.Default with SourceFiles = [| "A.fs"; fileName; "C.fs" |] } + let parsingOptions = { FSharpParsingOptions.Default with SourceFiles = [| "A.fs"; fileName; "C.fs" |] } let sourceText = SourceText.ofString """ module B @@ -1091,7 +1091,7 @@ let b : int = ExtraIdentUserNeverWroteRulezzz let! parseResult = checker.ParseFile(fileName, sourceText, parsingOptions, cache = true) Assert.False(parseResult.ParseHadErrors) Assert.True(Array.isEmpty parseResult.Diagnostics) - + let! parseAgainResult = checker.ParseFile(fileName, sourceText, parsingOptions, cache = true) Assert.False(parseAgainResult.ParseHadErrors) Assert.True(Array.isEmpty parseAgainResult.Diagnostics)