diff --git a/INTERNAL.md b/INTERNAL.md
index 6207180fd31..51cb12efd57 100644
--- a/INTERNAL.md
+++ b/INTERNAL.md
@@ -38,7 +38,7 @@ their respective branches.
[VS 16.1](https://dev.azure.com/devdiv/DevDiv/_release?definitionId=1669&_a=releases)
-VS 16.0 and prior were done manually
+VS 16.0 and prior were done manually.
## VS Insertions as part of the build definition
@@ -64,6 +64,7 @@ it's a good idea to check the previous link for any old or stalled insertions in
Update the `insertTargetBranch` value at the bottom of `azure-pipelines.yml` in the appropriate release branch. E.g., when VS 17.3 snapped and switched to ask mode, [this PR](https://github.com/dotnet/fsharp/pull/13456/files) correctly updates the insertion target so that future builds from that F# branch will get auto-inserted to VS.
### When VS `main` is open for insertions for preview releases of VS:
+
0. Disable auto-merges from `main` to **current** release branch, please make a change for the following file and create a pull request:
https://github.com/dotnet/roslyn-tools/blob/6d7c182c46f8319d7922561e2c1586c7aadce19e/src/GitHubCreateMergePRs/config.xml#L52-L74
> You should comment out the `main -> release/devXX.X` flow until step #4 is completed (``)
@@ -131,6 +132,23 @@ Since github issue filtering is currently not flexible enough, that query was ge
Invoke-WebRequest -Uri "https://api.github.com/repos/dotnet/fsharp/labels?per_page=100" | ConvertFrom-Json | % { $_.name } | ? { $_.StartsWith("Area-") } | % { Write-Host -NoNewLine ('-label:"' + $_ + '" ') }
```
-## Other links
+## Fix problems with the internal source mirror
+
+The repo is [here](https://dev.azure.com/dnceng/internal/_git/dotnet-fsharp), the CI is [here](https://dnceng.visualstudio.com/internal/_build?definitionId=499).
+
+If something breaks in the CI there and you want to experiment, the general workflow is the following:
+1. Make a branch
+2. Make a change
+3. Run the build from your branch. If needed, set the "skipTests" variable to "true" - can save time at this stage.
+4. Once the problem and the fix is identified, make a PR to THIS (dotnet/fsharp) repo - it will propagate to the internal mirror just afterwards.
+5. Delete all your work in the internal repo.
+
+**DO NOT** try to push to the internal repo - this will mess up the flows. **DO NOT** create PRs to not confuse anyone.
+
+You need the following permissions to do the above investigations:
+- "Generic contribute"
+- "Create branch"
+- "Queue builds"
+- "Edit queue build configuration"
-[Internal source mirror](https://dev.azure.com/dnceng/internal/_git/dotnet-fsharp).
+If anything, reach out to the "First Responders" team.
\ No newline at end of file
diff --git a/global.json b/global.json
index 6d23934c7ed..b866e3068b4 100644
--- a/global.json
+++ b/global.json
@@ -11,7 +11,7 @@
"Microsoft.VisualStudio.Component.FSharp"
]
},
- "xcopy-msbuild": "17.8.5"
+ "xcopy-msbuild": "17.12.0"
},
"native-tools": {
"perl": "5.38.2.2"
diff --git a/src/FSharp.Core/FSharp.Core.fsproj b/src/FSharp.Core/FSharp.Core.fsproj
index 97a02162fa4..b0abd5048bd 100644
--- a/src/FSharp.Core/FSharp.Core.fsproj
+++ b/src/FSharp.Core/FSharp.Core.fsproj
@@ -64,7 +64,6 @@
Microsoft.FSharp.Core.SR
FSCore.resx
-
diff --git a/src/FSharp.Core/ILLink.LinkAttributes.xml b/src/FSharp.Core/ILLink.LinkAttributes.xml
deleted file mode 100644
index 47a3ff01f02..00000000000
--- a/src/FSharp.Core/ILLink.LinkAttributes.xml
+++ /dev/null
@@ -1,179 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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)
diff --git a/tests/FSharp.Compiler.Service.Tests/Common.fs b/tests/FSharp.Compiler.Service.Tests/Common.fs
index 986e2be5132..18276ae39a9 100644
--- a/tests/FSharp.Compiler.Service.Tests/Common.fs
+++ b/tests/FSharp.Compiler.Service.Tests/Common.fs
@@ -473,63 +473,16 @@ let assertRange
Assert.Equal(Position.mkPos expectedStartLine expectedStartColumn, actualRange.Start)
Assert.Equal(Position.mkPos expectedEndLine expectedEndColumn, actualRange.End)
-[]
-module TempDirUtils =
- let getTempPath dir =
- Path.Combine(tempDirectoryOfThisTestRun.Value.FullName, dir)
-
- /// Returns the file name part of a temp file name created with tryCreateTemporaryFileName ()
- /// and an added process id and thread id to ensure uniqueness between threads.
- let getTempFileName() =
- let tempFileName = getTemporaryFileName ()
- try
- let tempFile, tempExt = Path.GetFileNameWithoutExtension tempFileName, Path.GetExtension tempFileName
- let procId, threadId = Process.GetCurrentProcess().Id, Thread.CurrentThread.ManagedThreadId
- String.concat "" [tempFile; "_"; string procId; "_"; string threadId; tempExt] // ext includes dot
- finally
- try
- FileSystem.FileDeleteShim tempFileName
- with _ -> ()
-
- /// Given just a file name, returns it with changed extension located in %TEMP%\ExprTests
- let getTempFilePathChangeExt dir tmp ext =
- Path.Combine(getTempPath dir, Path.ChangeExtension(tmp, ext))
-
- /// If it doesn't exists, create a folder 'ExprTests' in local user's %TEMP% folder
- let createTempDir dirName =
- let tempPath = getTempPath dirName
- do
- if Directory.Exists tempPath then ()
- else Directory.CreateDirectory tempPath |> ignore
-
- /// Clean up after a test is run. If you need to inspect the create *.fs files, change this function to do nothing, or just break here.
- let cleanupTempFiles dirName files =
- { new IDisposable with
- member _.Dispose() =
- for fileName in files do
- try
- // cleanup: only the source file is written to the temp dir.
- FileSystem.FileDeleteShim fileName
- with _ -> ()
-
- try
- // remove the dir when empty
- let tempPath = getTempPath dirName
- if Directory.GetFiles tempPath |> Array.isEmpty then
- Directory.Delete tempPath
- with _ -> () }
-
- let createProjectOptions dirName fileSources extraArgs =
- let fileNames = fileSources |> List.map (fun _ -> getTempFileName())
- let temp2 = getTempFileName()
- let fileNames = fileNames |> List.map (fun temp1 -> getTempFilePathChangeExt dirName temp1 ".fs")
- let dllName = getTempFilePathChangeExt dirName temp2 ".dll"
- let projFileName = getTempFilePathChangeExt dirName temp2 ".fsproj"
-
- createTempDir dirName
- for fileSource: string, fileName in List.zip fileSources fileNames do
- FileSystem.OpenFileForWriteShim(fileName).Write(fileSource)
- let args = [| yield! extraArgs; yield! mkProjectCommandLineArgs (dllName, []) |]
- let options = { checker.GetProjectOptionsFromCommandLineArgs (projFileName, args) with SourceFiles = fileNames |> List.toArray }
-
- cleanupTempFiles dirName (fileNames @ [dllName; projFileName]), options
+let createProjectOptions fileSources extraArgs =
+ let tempDir = createTemporaryDirectory()
+ let temp2 = getTemporaryFileNameInDirectory tempDir
+ let dllName = changeExtension temp2 ".dll"
+ let projFileName = changeExtension temp2 ".fsproj"
+
+ let sourceFiles =
+ [| for fileSource: string in fileSources do
+ let fileName = changeExtension (getTemporaryFileNameInDirectory tempDir) ".fs"
+ FileSystem.OpenFileForWriteShim(fileName).Write(fileSource)
+ fileName |]
+ let args = [| yield! extraArgs; yield! mkProjectCommandLineArgs (dllName, []) |]
+ { checker.GetProjectOptionsFromCommandLineArgs (projFileName, args) with SourceFiles = sourceFiles }
diff --git a/tests/FSharp.Compiler.Service.Tests/ExprTests.fs b/tests/FSharp.Compiler.Service.Tests/ExprTests.fs
index 251e1fc3a91..7a594db1e38 100644
--- a/tests/FSharp.Compiler.Service.Tests/ExprTests.fs
+++ b/tests/FSharp.Compiler.Service.Tests/ExprTests.fs
@@ -13,6 +13,8 @@ open FSharp.Compiler.Service.Tests.Common
open FSharp.Compiler.Symbols
open FSharp.Compiler.Symbols.FSharpExprPatterns
+open TestFramework
+
type FSharpCore =
| FC45
| FC46
@@ -593,7 +595,7 @@ let testMutableVar = mutableVar 1
let testMutableConst = mutableConst ()
"""
- let createOptionsWithArgs args = createProjectOptions dirName [ fileSource1; fileSource2 ] args
+ let createOptionsWithArgs args = createProjectOptions [ fileSource1; fileSource2 ] args
let createOptions() = createOptionsWithArgs []
@@ -659,8 +661,7 @@ let test{0}ToStringOperator (e1:{1}) = string e1
/// This test is run in unison with its optimized counterpart below
[]
let ``Test Unoptimized Declarations Project1`` () =
- let cleanup, options = Project1.createOptionsWithArgs [ "--langversion:preview" ]
- use _holder = cleanup
+ let options = Project1.createOptionsWithArgs [ "--langversion:preview" ]
let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=CompilerAssertHelpers.UseTransparentCompiler)
let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate
@@ -798,8 +799,7 @@ let ``Test Unoptimized Declarations Project1`` () =
[]
let ``Test Optimized Declarations Project1`` () =
- let cleanup, options = Project1.createOptionsWithArgs [ "--langversion:preview" ]
- use _holder = cleanup
+ let options = Project1.createOptionsWithArgs [ "--langversion:preview" ]
let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=CompilerAssertHelpers.UseTransparentCompiler)
let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate
@@ -938,15 +938,13 @@ let ``Test Optimized Declarations Project1`` () =
let testOperators dnName fsName excludedTests expectedUnoptimized expectedOptimized =
- let tempFileName = getTempFileName()
- let filePath = getTempFilePathChangeExt dirName tempFileName ".fs"
- let dllPath =getTempFilePathChangeExt dirName tempFileName ".dll"
- let projFilePath = getTempFilePathChangeExt dirName tempFileName ".fsproj"
+ let tempFileName = getTemporaryFileName()
+ let filePath = changeExtension tempFileName ".fs"
+ let dllPath =changeExtension tempFileName ".dll"
+ let projFilePath = changeExtension tempFileName ".fsproj"
let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=true)
begin
- use _cleanup = cleanupTempFiles dirName [filePath; dllPath; projFilePath]
- createTempDir dirName
let source = String.Format(Project1.operatorTests, dnName, fsName)
let replace (s:string) r = s.Replace("let " + r, "// let " + r)
let fileSource = excludedTests |> List.fold replace source
@@ -3128,7 +3126,7 @@ let BigSequenceExpression(outFileOpt,docFileOpt,baseAddressOpt) =
"""
- let createOptions() = createProjectOptions dirName [fileSource1] []
+ let createOptions() = createProjectOptions [fileSource1] []
#if !NETFRAMEWORK && DEBUG
[]
@@ -3136,8 +3134,7 @@ let BigSequenceExpression(outFileOpt,docFileOpt,baseAddressOpt) =
[]
#endif
let ``Test expressions of declarations stress big expressions`` () =
- let cleanup, options = ProjectStressBigExpressions.createOptions()
- use _holder = cleanup
+ let options = ProjectStressBigExpressions.createOptions()
let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=CompilerAssertHelpers.UseTransparentCompiler)
let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate
@@ -3155,8 +3152,7 @@ let ``Test expressions of declarations stress big expressions`` () =
[]
#endif
let ``Test expressions of optimized declarations stress big expressions`` () =
- let cleanup, options = ProjectStressBigExpressions.createOptions()
- use _holder = cleanup
+ let options = ProjectStressBigExpressions.createOptions()
let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=CompilerAssertHelpers.UseTransparentCompiler)
let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate
@@ -3211,12 +3207,11 @@ let f7() = callXY (C()) (D())
let f8() = callXY (D()) (C())
"""
- let createOptions() = createProjectOptions dirName [fileSource1] ["--langversion:7.0"]
+ let createOptions() = createProjectOptions [fileSource1] ["--langversion:7.0"]
[]
let ``Test ProjectForWitnesses1`` () =
- let cleanup, options = ProjectForWitnesses1.createOptions()
- use _holder = cleanup
+ let options = ProjectForWitnesses1.createOptions()
let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=CompilerAssertHelpers.UseTransparentCompiler)
let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate
@@ -3259,8 +3254,7 @@ let ``Test ProjectForWitnesses1`` () =
[]
let ``Test ProjectForWitnesses1 GetWitnessPassingInfo`` () =
- let cleanup, options = ProjectForWitnesses1.createOptions()
- use _holder = cleanup
+ let options = ProjectForWitnesses1.createOptions()
let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=CompilerAssertHelpers.UseTransparentCompiler)
let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate
@@ -3335,12 +3329,11 @@ type MyNumberWrapper =
{ MyNumber: MyNumber }
"""
- let createOptions() = createProjectOptions dirName [fileSource1] ["--langversion:7.0"]
+ let createOptions() = createProjectOptions [fileSource1] ["--langversion:7.0"]
[]
let ``Test ProjectForWitnesses2`` () =
- let cleanup, options = ProjectForWitnesses2.createOptions()
- use _holder = cleanup
+ let options = ProjectForWitnesses2.createOptions()
let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=CompilerAssertHelpers.UseTransparentCompiler)
let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate
@@ -3391,12 +3384,11 @@ let s2 = sign p1
"""
- let createOptions() = createProjectOptions dirName [fileSource1] ["--langversion:7.0"]
+ let createOptions() = createProjectOptions [fileSource1] ["--langversion:7.0"]
[]
let ``Test ProjectForWitnesses3`` () =
- let cleanup, options = createProjectOptions dirName [ ProjectForWitnesses3.fileSource1 ] ["--langversion:7.0"]
- use _holder = cleanup
+ let options = createProjectOptions [ ProjectForWitnesses3.fileSource1 ] ["--langversion:7.0"]
let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=CompilerAssertHelpers.UseTransparentCompiler)
let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate
@@ -3426,8 +3418,7 @@ let ``Test ProjectForWitnesses3`` () =
[]
let ``Test ProjectForWitnesses3 GetWitnessPassingInfo`` () =
- let cleanup, options = ProjectForWitnesses3.createOptions()
- use _holder = cleanup
+ let options = ProjectForWitnesses3.createOptions()
let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=CompilerAssertHelpers.UseTransparentCompiler)
let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate
@@ -3485,12 +3476,11 @@ let isNullQuoted (ts : 't[]) =
"""
- let createOptions() = createProjectOptions dirName [fileSource1] ["--langversion:7.0"]
+ let createOptions() = createProjectOptions [fileSource1] ["--langversion:7.0"]
[]
let ``Test ProjectForWitnesses4 GetWitnessPassingInfo`` () =
- let cleanup, options = ProjectForWitnesses4.createOptions()
- use _holder = cleanup
+ let options = ProjectForWitnesses4.createOptions()
let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=CompilerAssertHelpers.UseTransparentCompiler)
let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate
@@ -3523,12 +3513,11 @@ module N.M
let rec f = new System.EventHandler(fun _ _ -> f.Invoke(null,null))
"""
- let createOptions() = createProjectOptions dirName [fileSource1] []
+ let createOptions() = createProjectOptions [fileSource1] []
[]
let ``Test NoWarn HashDirective`` () =
- let cleanup, options = ProjectForNoWarnHashDirective.createOptions()
- use _holder = cleanup
+ let options = ProjectForNoWarnHashDirective.createOptions()
let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=CompilerAssertHelpers.UseTransparentCompiler)
let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate
diff --git a/tests/FSharp.Compiler.Service.Tests/GeneratedCodeSymbolsTests.fs b/tests/FSharp.Compiler.Service.Tests/GeneratedCodeSymbolsTests.fs
index 66b9782fb29..5fac752952c 100644
--- a/tests/FSharp.Compiler.Service.Tests/GeneratedCodeSymbolsTests.fs
+++ b/tests/FSharp.Compiler.Service.Tests/GeneratedCodeSymbolsTests.fs
@@ -5,9 +5,6 @@ open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.Service.Tests.Common
open FSharp.Compiler.Symbols
-[]
-let dirName = "GeneratedCodeSymbolsTests"
-
[]
let ``IsUnionCaseTester for Is* member in a class`` () =
let source = """
@@ -16,8 +13,7 @@ module Lib
type T () =
member x.IsM = 1
"""
- let cleanup, options = createProjectOptions dirName [ source ] [ "--langversion:preview" ]
- use _holder = cleanup
+ let options = createProjectOptions [ source ] [ "--langversion:preview" ]
let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=false)
let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate
@@ -46,8 +42,7 @@ module Lib
type T = A | B
"""
- let cleanup, options = createProjectOptions dirName [ source ] [ "--langversion:preview" ]
- use _holder = cleanup
+ let options = createProjectOptions [ source ] [ "--langversion:preview" ]
let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=false)
let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate
@@ -80,8 +75,7 @@ type T =
member x.IsC
with get () = false
"""
- let cleanup, options = createProjectOptions dirName [ source ] [ "--langversion:preview" ]
- use _holder = cleanup
+ let options = createProjectOptions [ source ] [ "--langversion:preview" ]
let exprChecker = FSharpChecker.Create(keepAssemblyContents=true, useTransparentCompiler=false)
let wholeProjectResults = exprChecker.ParseAndCheckProject(options) |> Async.RunImmediate
diff --git a/tests/FSharp.Compiler.Service.Tests/ScriptOptionsTests.fs b/tests/FSharp.Compiler.Service.Tests/ScriptOptionsTests.fs
index 2d197af0398..328272defb8 100644
--- a/tests/FSharp.Compiler.Service.Tests/ScriptOptionsTests.fs
+++ b/tests/FSharp.Compiler.Service.Tests/ScriptOptionsTests.fs
@@ -41,9 +41,9 @@ let ``can generate options for different frameworks regardless of execution envi
[]
[]
let ``can resolve nuget packages to right target framework for different frameworks regardless of execution environment``(flag) =
- let path = DirectoryInfo(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)).FullName
- let file = (getTemporaryFileNameInDirectory path) + ".fsx"
- let scriptFullPath = Path.Combine(path, file)
+ let dir = DirectoryInfo(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location))
+ let file = (getTemporaryFileNameInDirectory dir) + ".fsx"
+ let scriptFullPath = Path.Combine(dir.FullName, file)
let scriptSource = """
#r "nuget: FSharp.Data, 3.3.3"
open System
diff --git a/tests/FSharp.Test.Utilities/CompilerAssert.fs b/tests/FSharp.Test.Utilities/CompilerAssert.fs
index 202f7704a9d..5253ef16934 100644
--- a/tests/FSharp.Test.Utilities/CompilerAssert.fs
+++ b/tests/FSharp.Test.Utilities/CompilerAssert.fs
@@ -444,7 +444,7 @@ module CompilerAssertHelpers =
let name =
match nameOpt with
| Some name -> name
- | _ -> getTemporaryFileNameInDirectory outputDirectory.FullName
+ | _ -> getTemporaryFileNameInDirectory outputDirectory
let outputFilePath = Path.ChangeExtension (Path.Combine(outputDirectory.FullName, name), if isExe then ".exe" else ".dll")
let sources =
@@ -508,7 +508,7 @@ module CompilerAssertHelpers =
let compile isExe options (source:SourceCodeFileKind) f =
let outputFilePath = Path.ChangeExtension (getTemporaryFileName (), if isExe then ".exe" else ".dll")
- let tempDir = Path.GetDirectoryName outputFilePath
+ let tempDir = Directory.GetParent outputFilePath
let sourceFile =
match source.GetSourceText with
@@ -521,10 +521,7 @@ module CompilerAssertHelpers =
// On Disk file
source
- try
- f (rawCompile outputFilePath isExe options TargetFramework.Current [sourceFile])
- finally
- try Directory.Delete(tempDir, true) with | _ -> ()
+ f (rawCompile outputFilePath isExe options TargetFramework.Current [sourceFile])
let rec compileCompilationAux outputDirectory ignoreWarnings (cmpl: Compilation) : (FSharpDiagnostic[] * exn option * string) * string list =
@@ -548,7 +545,7 @@ module CompilerAssertHelpers =
res, (deps @ deps2)
- and evaluateReferences (outputPath:DirectoryInfo) ignoreWarnings (cmpl: Compilation) : string[] * string list =
+ and evaluateReferences (outputDir:DirectoryInfo) ignoreWarnings (cmpl: Compilation) : string[] * string list =
match cmpl with
| Compilation(_, _, _, _, cmpls, _, _) ->
let compiledRefs =
@@ -556,13 +553,13 @@ module CompilerAssertHelpers =
|> List.map (fun cmpl ->
match cmpl with
| CompilationReference (cmpl, staticLink) ->
- compileCompilationAux outputPath ignoreWarnings cmpl, staticLink
+ compileCompilationAux outputDir ignoreWarnings cmpl, staticLink
| TestCompilationReference (cmpl) ->
let fileName =
match cmpl with
| TestCompilation.CSharp c when not (String.IsNullOrWhiteSpace c.AssemblyName) -> c.AssemblyName
- | _ -> getTemporaryFileNameInDirectory outputPath.FullName
- let tmp = Path.Combine(outputPath.FullName, Path.ChangeExtension(fileName, ".dll"))
+ | _ -> getTemporaryFileNameInDirectory outputDir
+ let tmp = Path.Combine(outputDir.FullName, Path.ChangeExtension(fileName, ".dll"))
cmpl.EmitAsFile tmp
(([||], None, tmp), []), false)
diff --git a/tests/FSharp.Test.Utilities/TestFramework.fs b/tests/FSharp.Test.Utilities/TestFramework.fs
index ada5bf3363e..f50452eff9e 100644
--- a/tests/FSharp.Test.Utilities/TestFramework.fs
+++ b/tests/FSharp.Test.Utilities/TestFramework.fs
@@ -29,8 +29,10 @@ let createTemporaryDirectory () =
let getTemporaryFileName () =
createTemporaryDirectory().FullName ++ getShortId()
-let getTemporaryFileNameInDirectory (directory: string) =
- directory ++ getShortId()
+let changeExtension path extension = Path.ChangeExtension(path, extension)
+
+let getTemporaryFileNameInDirectory (directory: DirectoryInfo) =
+ directory.FullName ++ getShortId()
// Well, this function is AI generated.
let rec copyDirectory (sourceDir: string) (destinationDir: string) (recursive: bool) =