From c8567d3cceacf626c0b04b273e1eb5c9376a09c2 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Mon, 28 Oct 2024 18:24:11 +0100 Subject: [PATCH] reenable transparent compiler tests --- .../FSharpChecker/TransparentCompiler.fs | 63 +++++++++---------- .../BuildGraphTests.fs | 2 +- .../MultiProjectAnalysisTests.fs | 2 +- .../ProjectAnalysisTests.fs | 16 ++--- 4 files changed, 40 insertions(+), 43 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs index 8bc9ac09f05..8c9e020c8fb 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs +++ b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs @@ -30,7 +30,7 @@ open OpenTelemetry.Trace #nowarn "57" -[] +[] let ``Use Transparent Compiler`` () = let size = 20 @@ -60,7 +60,7 @@ let ``Use Transparent Compiler`` () = checkFile last expectSignatureChanged } -[] +[] let ``Parallel processing`` () = let project = SyntheticProject.Create( @@ -78,7 +78,7 @@ let ``Parallel processing`` () = checkFile "E" expectSignatureChanged } -[] +[] let ``Parallel processing with signatures`` () = let project = SyntheticProject.Create( @@ -113,7 +113,7 @@ let makeTestProject () = let testWorkflow () = ProjectWorkflowBuilder(makeTestProject(), useTransparentCompiler = true) -[] +[] let ``Edit file, check it, then check dependent file`` () = testWorkflow() { updateFile "First" breakDependentFiles @@ -121,21 +121,21 @@ let ``Edit file, check it, then check dependent file`` () = checkFile "Second" expectErrors } -[] +[] let ``Edit file, don't check it, check dependent file`` () = testWorkflow() { updateFile "First" breakDependentFiles checkFile "Second" expectErrors } -[] +[] let ``Check transitive dependency`` () = testWorkflow() { updateFile "First" breakDependentFiles checkFile "Last" expectSignatureChanged } -[] +[] let ``Change multiple files at once`` () = testWorkflow() { updateFile "First" (setPublicVersion 2) @@ -144,7 +144,7 @@ let ``Change multiple files at once`` () = checkFile "Last" (expectSignatureContains "val f: x: 'a -> (ModuleFirst.TFirstV_2<'a> * ModuleSecond.TSecondV_2<'a>) * (ModuleFirst.TFirstV_2<'a> * ModuleThird.TThirdV_2<'a>) * TLastV_1<'a>") } -[] +[] let ``Files depend on signature file if present`` () = let project = makeTestProject() |> updateFile "First" addSignatureFile @@ -154,7 +154,7 @@ let ``Files depend on signature file if present`` () = checkFile "Second" expectNoChanges } -[] +[] let ``Project with signatures`` () = let project = SyntheticProject.Create( @@ -169,7 +169,7 @@ let ``Project with signatures`` () = checkFile "Second" expectOk } -[] +[] let ``Signature update`` () = let project = SyntheticProject.Create( @@ -185,7 +185,7 @@ let ``Signature update`` () = checkFile "Second" expectSignatureChanged } -[] +[] let ``Adding a file`` () = testWorkflow() { addFileAbove "Second" (sourceFile "New" []) @@ -193,14 +193,14 @@ let ``Adding a file`` () = checkFile "Last" (expectSignatureContains "val f: x: 'a -> (ModuleFirst.TFirstV_1<'a> * ModuleNew.TNewV_1<'a> * ModuleSecond.TSecondV_1<'a>) * (ModuleFirst.TFirstV_1<'a> * ModuleThird.TThirdV_1<'a>) * TLastV_1<'a>") } -[] +[] let ``Removing a file`` () = testWorkflow() { removeFile "Second" checkFile "Last" expectErrors } -[] +[] let ``Changes in a referenced project`` () = let library = SyntheticProject.Create("library", sourceFile "Library" []) @@ -219,7 +219,7 @@ let ``Changes in a referenced project`` () = } -[] +[] let ``File is not checked twice`` () = let cacheEvents = ConcurrentQueue() @@ -243,7 +243,7 @@ let ``File is not checked twice`` () = Assert.Equal([Weakened; Requested; Started; Finished], intermediateTypeChecks["FileFirst.fs"]) Assert.Equal([Weakened; Requested; Started; Finished], intermediateTypeChecks["FileThird.fs"]) -[] +[] let ``If a file is checked as a dependency it's not re-checked later`` () = let cacheEvents = ConcurrentQueue() @@ -267,7 +267,7 @@ let ``If a file is checked as a dependency it's not re-checked later`` () = Assert.Equal([Weakened; Requested; Started; Finished; Requested], intermediateTypeChecks["FileThird.fs"]) -// [] TODO: differentiate complete and minimal checking requests +// [] TODO: differentiate complete and minimal checking requests let ``We don't check files that are not depended on`` () = let project = SyntheticProject.Create( sourceFile "First" [], @@ -297,7 +297,7 @@ let ``We don't check files that are not depended on`` () = Assert.Equal([Started; Finished], intermediateTypeChecks["FileThird.fs"]) Assert.False (intermediateTypeChecks.ContainsKey "FileSecond.fs") -// [] TODO: differentiate complete and minimal checking requests +// [] TODO: differentiate complete and minimal checking requests let ``Files that are not depended on don't invalidate cache`` () = let project = SyntheticProject.Create( sourceFile "First" [], @@ -338,7 +338,7 @@ let ``Files that are not depended on don't invalidate cache`` () = Assert.Equal([], intermediateTypeChecks |> Map.toList) -// [] TODO: differentiate complete and minimal checking requests +// [] TODO: differentiate complete and minimal checking requests let ``Files that are not depended on don't invalidate cache part 2`` () = let project = SyntheticProject.Create( sourceFile "A" [], @@ -378,7 +378,7 @@ let ``Files that are not depended on don't invalidate cache part 2`` () = Assert.Equal(["FileE.fs", [Started; Finished]], graphConstructions) Assert.Equal(["FileE.fs", [Started; Finished]], intermediateTypeChecks) -[] +[] let ``Changing impl files doesn't invalidate cache when they have signatures`` () = let project = SyntheticProject.Create( { sourceFile "A" [] with SignatureFile = AutoGenerated }, @@ -407,7 +407,7 @@ let ``Changing impl files doesn't invalidate cache when they have signatures`` ( Assert.Equal([], intermediateTypeChecks) -[] +[] let ``Changing impl file doesn't invalidate an in-memory referenced project`` () = let library = SyntheticProject.Create("library", { sourceFile "A" [] with SignatureFile = AutoGenerated }) @@ -646,13 +646,10 @@ let fuzzingTest seed (project: SyntheticProject) = task { builder.DeleteProjectDir() } - -(* This gets in the way of insertions too often now, uncomment when stable. [] [] [] [] -*) let Fuzzing signatureFiles = let seed = System.Random().Next() @@ -790,7 +787,7 @@ module Stuff = let fileName, snapshot, checker = singleFileChecker source checker.ParseFile(fileName, snapshot) |> Async.RunSynchronously - //[] + //[] let ``Hash stays the same when whitespace changes`` () = //let parseResult = getParseResult source @@ -846,7 +843,7 @@ let ``TypeCheck last file in project with transparent compiler`` useTransparentC checkFile lastFile expectOk } -[] +[] let ``LoadClosure for script is computed once`` () = let project = SyntheticProject.CreateForScript( sourceFile "First" []) @@ -871,7 +868,7 @@ let ``LoadClosure for script is computed once`` () = Assert.Empty(closureComputations) -[] +[] let ``LoadClosure for script is recomputed after changes`` () = let project = SyntheticProject.CreateForScript( sourceFile "First" []) @@ -900,7 +897,7 @@ let ``LoadClosure for script is recomputed after changes`` () = Assert.Equal([Weakened; Requested; Started; Finished; Weakened; Requested; Started; Finished], closureComputations["FileFirst.fs"]) -[] +[] let ``TryGetRecentCheckResultsForFile returns None before first call to ParseAndCheckFileInProject`` () = let project = SyntheticProject.Create( sourceFile "First" []) @@ -910,7 +907,7 @@ let ``TryGetRecentCheckResultsForFile returns None before first call to ParseAnd tryGetRecentCheckResults "First" expectNone } |> ignore -[] +[] let ``TryGetRecentCheckResultsForFile returns result after first call to ParseAndCheckFileInProject`` () = let project = SyntheticProject.Create( sourceFile "First" [] ) @@ -919,7 +916,7 @@ let ``TryGetRecentCheckResultsForFile returns result after first call to ParseAn tryGetRecentCheckResults "First" expectSome } |> ignore -[] +[] let ``TryGetRecentCheckResultsForFile returns no result after edit`` () = let project = SyntheticProject.Create( sourceFile "First" []) @@ -932,7 +929,7 @@ let ``TryGetRecentCheckResultsForFile returns no result after edit`` () = tryGetRecentCheckResults "First" expectSome } |> ignore -[] +[] let ``TryGetRecentCheckResultsForFile returns result after edit of other file`` () = let project = SyntheticProject.Create( sourceFile "First" [], @@ -946,9 +943,9 @@ let ``TryGetRecentCheckResultsForFile returns result after edit of other file`` tryGetRecentCheckResults "Second" expectSome // file didn't change so we still want to get the recent result } |> ignore -[] +[] let ``Background compiler and Transparent compiler return the same options`` () = - async { + task { let backgroundChecker = FSharpChecker.Create(useTransparentCompiler = false) let transparentChecker = FSharpChecker.Create(useTransparentCompiler = true) let scriptName = Path.Combine(__SOURCE_DIRECTORY__, "script.fsx") @@ -1013,7 +1010,7 @@ printfn "Hello from F#" checkFile "As 01" expectTwoWarnings } -[] +[] let ``Transparent Compiler ScriptClosure cache is populated after GetProjectOptionsFromScript`` () = async { let transparentChecker = FSharpChecker.Create(useTransparentCompiler = true) diff --git a/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs b/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs index 4769b4c322d..c87f2926e74 100644 --- a/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/BuildGraphTests.fs @@ -183,7 +183,7 @@ module BuildGraphTests = Assert.shouldBeTrue(ex <> null) try task.Wait(1000) |> ignore with | :? TimeoutException -> reraise() | _ -> () - [] + [] let ``Many requests to get a value asynchronously might evaluate the computation more than once even when some requests get canceled``() = let requests = 10000 let resetEvent = new ManualResetEvent(false) diff --git a/tests/FSharp.Compiler.Service.Tests/MultiProjectAnalysisTests.fs b/tests/FSharp.Compiler.Service.Tests/MultiProjectAnalysisTests.fs index 3564288b229..22c17f48871 100644 --- a/tests/FSharp.Compiler.Service.Tests/MultiProjectAnalysisTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/MultiProjectAnalysisTests.fs @@ -444,7 +444,7 @@ let z = Project1.x ReferencedProjects = [| FSharpReferencedProject.FSharpReference(MultiProjectDirty1.dllName, MultiProjectDirty1.getOptions()) |] } [] -// [] +[] [] let ``Test multi project symbols should pick up changes in dependent projects`` useTransparentCompiler = diff --git a/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs b/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs index 807fa90c78c..b52435e54a5 100644 --- a/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs @@ -4647,7 +4647,7 @@ let callToOverload = B(5).Overload(4) let args = mkProjectCommandLineArgs (dllName, []) [] -// [] // Flaky, reenable when stable +[] // Flaky, reenable when stable [] let ``Test project36 FSharpMemberOrFunctionOrValue.IsBaseValue`` useTransparentCompiler = let keepAssemblyContentsChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=useTransparentCompiler) @@ -4664,7 +4664,7 @@ let ``Test project36 FSharpMemberOrFunctionOrValue.IsBaseValue`` useTransparentC |> fun baseSymbol -> shouldEqual true baseSymbol.IsBaseValue [] -// [] // Flaky, reenable when stable +[] // Flaky, reenable when stable [] let ``Test project36 FSharpMemberOrFunctionOrValue.IsConstructorThisValue & IsMemberThisValue`` useTransparentCompiler = let keepAssemblyContentsChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=useTransparentCompiler) @@ -4703,7 +4703,7 @@ let ``Test project36 FSharpMemberOrFunctionOrValue.IsConstructorThisValue & IsMe |> shouldEqual true [] -// [] // Flaky, reenable when stable +[] // Flaky, reenable when stable [] let ``Test project36 FSharpMemberOrFunctionOrValue.LiteralValue`` useTransparentCompiler = let keepAssemblyContentsChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=useTransparentCompiler) @@ -5324,7 +5324,7 @@ let foo (a: Foo): bool = let options = { checker.GetProjectOptionsFromCommandLineArgs (projFileName, args) with SourceFiles = fileNames } [] -// [] // Flaky, reenable when stable +[] // Flaky, reenable when stable [] let ``Test typed AST for struct unions`` useTransparentCompiler = // See https://github.com/fsharp/FSharp.Compiler.Service/issues/756 let keepAssemblyContentsChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=useTransparentCompiler) @@ -5414,7 +5414,7 @@ let ``Test diagnostics with line directives ignored`` () = //------------------------------------------------------ [] -// [] // Flaky, reenable when stable +[] // Flaky, reenable when stable [] let ``ParseAndCheckFileResults contains ImplFile list if FSharpChecker is created with keepAssemblyContent flag set to true`` useTransparentCompiler = @@ -5500,7 +5500,7 @@ let ``#4030, Incremental builder creation warnings 5`` () = //------------------------------------------------------ [] -// [] // Flaky, reenable when stable +[] // Flaky, reenable when stable [] let ``Unused opens in rec module smoke test 1`` useTransparentCompiler = @@ -5575,7 +5575,7 @@ type UseTheThings(i:int) = unusedOpensData |> shouldEqual expected [] -// [] // Flaky, reenable when stable +[] // Flaky, reenable when stable [] let ``Unused opens in non rec module smoke test 1`` useTransparentCompiler = @@ -5664,7 +5664,7 @@ type UseTheThings(i:int) = unusedOpensData |> shouldEqual expected [] -// [] // Flaky, reenable when stable +[] // Flaky, reenable when stable [] let ``Unused opens smoke test auto open`` useTransparentCompiler =