From dd79ce32c61f866ddce826ae6b578daae9cde665 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Tue, 8 Nov 2022 02:46:38 -0800 Subject: [PATCH 1/5] checked --- .../fsc/checked/UncheckedDefaultOf01.fs | 0 .../CompilerOptions/fsc/checked/checked.fs | 171 ++++++++++++++++++ .../CompilerOptions/fsc/checked/checked01.fs | 0 .../fsc/checked/unchecked01.fs | 0 .../CompilerOptions/fsc/checked/unrecogarg.fs | 0 .../FSharp.Compiler.ComponentTests.fsproj | 1 + .../CompilerOptions/fsc/checked/env.lst | 29 --- 7 files changed, 172 insertions(+), 29 deletions(-) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/CompilerOptions/fsc/checked/UncheckedDefaultOf01.fs (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/CompilerOptions/fsc/checked/checked01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/CompilerOptions/fsc/checked/unchecked01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/CompilerOptions/fsc/checked/unrecogarg.fs (100%) delete mode 100644 tests/fsharpqa/Source/CompilerOptions/fsc/checked/env.lst diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/checked/UncheckedDefaultOf01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/UncheckedDefaultOf01.fs similarity index 100% rename from tests/fsharpqa/Source/CompilerOptions/fsc/checked/UncheckedDefaultOf01.fs rename to tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/UncheckedDefaultOf01.fs diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked.fs new file mode 100644 index 0000000000..7e71190ff0 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked.fs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.ComponentTests.CompilerOptions + +open FSharp.Test +open FSharp.Test.Compiler +open Xunit + +module Checked = + + // SOURCE=unchecked01.fs # fsc-default + [] + let ``fsc-unchecked - unchecked01.fs`` compilation = + compilation + |> asFs + |> compile + |> shouldSucceed + + // SOURCE=checked01.fs SCFLAGS="--checked" # fsc-checked + [] + let ``fsc-unchecked - unchecked01.fs --checked`` compilation = + compilation + |> asFs + |> withOptions["--checked"] + |> compile + |> shouldSucceed + + // SOURCE=checked01.fs SCFLAGS="--checked+" # fsc-checked+ + [] + let ``fsc-unchecked - unchecked01.fs --checked+`` compilation = + compilation + |> asFs + |> withOptions["--checked+"] + |> compile + |> shouldSucceed + + // SOURCE=unchecked01.fs SCFLAGS="--checked-" # fsc-checked- + [] + let ``fsc-unchecked - unchecked01.fs --checked-`` compilation = + compilation + |> asFs + |> withOptions["--checked-"] + |> compile + |> shouldSucceed + + // SOURCE=unchecked01.fs SCFLAGS="--checked-" # fsc-checked- + [] + let ``fsi-unchecked - unchecked01.fs --checked-`` compilation = + compilation + |> asFsx + |> withOptions["--checked-"] + |> compile + |> shouldSucceed + + // SOURCE=checked01.fs SCFLAGS="--checked" FSIMODE=EXEC COMPILE_ONLY=1 # fsi-checked + [] + let ``fsi-checked - checked01.fs --checked`` compilation = + compilation + |> asFsx + |> withOptions["--checked"] + |> compile + |> shouldSucceed + + // SOURCE=checked01.fs SCFLAGS="--checked+" FSIMODE=EXEC COMPILE_ONLY=1 # fsi-checked+ + [] + let ``fsi-checked - checked01.fs --checked+`` compilation = + compilation + |> asFsx + |> withOptions["--checked+"] + |> compile + |> shouldSucceed + + // SOURCE=checked01.fs SCFLAGS="--checked-" FSIMODE=EXEC COMPILE_ONLY=1 # fsi-checked+ + [] + let ``fsi-checked - checked01.fs --checked-`` compilation = + compilation + |> asFsx + |> withOptions["--checked-"] + |> compile + |> shouldSucceed + + + //# Last one wins + + // SOURCE=checked01.fs SCFLAGS="--checked --checked+" # fsc-checkedchecked+ + [] + let ``fsc-checked - checked01.fs --checked --checked+`` compilation = + compilation + |> asFs + |> withOptions["--checked"; "--checked+"] + |> compile + |> shouldSucceed + + // SOURCE=checked01.fs SCFLAGS="--checked- --checked+" # fsc-checked-checked+ + [] + let ``fsc-checked - checked01.fs --checked- --checked+`` compilation = + compilation + |> asFs + |> withOptions["--checked-"; "--checked+"] + |> compile + |> shouldSucceed + + // SOURCE=unchecked01.fs SCFLAGS="--checked+ --checked-" # fsc-checked+checked- + [] + let ``fsc-checked - unchecked01.fs --checked+ --checked-`` compilation = + compilation + |> asFs + |> withOptions["--checked+"; "--checked-"] + |> compile + |> shouldSucceed + + // SOURCE=checked01.fs SCFLAGS="--checked --checked+" # fsc-checkedchecked+ + [] + let ``fsi-checked - checked01.fs --checked --checked+`` compilation = + compilation + |> asFsx + |> withOptions["--checked"; "--checked+"] + |> compile + |> shouldSucceed + + // SOURCE=checked01.fs SCFLAGS="--checked- --checked+" # fsc-checked-checked+ + [] + let ``fsi-checked - checked01.fs --checked- --checked+`` compilation = + compilation + |> asFsx + |> withOptions["--checked-"; "--checked+"] + |> compile + |> shouldSucceed + + // SOURCE=unchecked01.fs SCFLAGS="--checked+ --checked-" # fsc-checked+checked- + [] + let ``fsi-checked - unchecked01.fs --checked+ --checked-`` compilation = + compilation + |> asFsx + |> withOptions["--checked+"; "--checked-"] + |> compile + |> shouldSucceed + + //# Unrecognized argument + // SOURCE=unrecogarg.fs SCFLAGS="--Checked" # fsc--Checked + [] + let ``fsc-checked - unchecked01.fs Checked`` compilation = + compilation + |> asFs + |> withOptions["--Checked"] + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 243, Line 0, Col 1, Line 0, Col 1, "Unrecognized option: '--Checked'") + ] + + // SOURCE=unrecogarg.fs SCFLAGS="--checked*" # fsc--checked* + [] + let ``fsc-checked - unchecked01.fs --checked-star`` compilation = + compilation + |> asFs + |> withOptions["--checked*"] + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 243, Line 0, Col 1, Line 0, Col 1, "Unrecognized option: '--checked*'") + ] + + // SOURCE=unrecogarg.fs SCFLAGS="--checked*" # fsc--checked* + [] + let ``fsc-checked - UncheckedDefaultOf01`` compilation = + compilation + |> asFs + |> asExe + |> compile + |> shouldSucceed diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/checked/checked01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked01.fs similarity index 100% rename from tests/fsharpqa/Source/CompilerOptions/fsc/checked/checked01.fs rename to tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked01.fs diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/checked/unchecked01.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/unchecked01.fs similarity index 100% rename from tests/fsharpqa/Source/CompilerOptions/fsc/checked/unchecked01.fs rename to tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/unchecked01.fs diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/checked/unrecogarg.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/unrecogarg.fs similarity index 100% rename from tests/fsharpqa/Source/CompilerOptions/fsc/checked/unrecogarg.fs rename to tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/unrecogarg.fs diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index bd6d518dce..fbc15aac23 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -185,6 +185,7 @@ + diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/checked/env.lst b/tests/fsharpqa/Source/CompilerOptions/fsc/checked/env.lst deleted file mode 100644 index dd474e8c37..0000000000 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/checked/env.lst +++ /dev/null @@ -1,29 +0,0 @@ -# Functional: - SOURCE=unchecked01.fs # fsc-default - SOURCE=checked01.fs SCFLAGS="--checked" # fsc-checked - SOURCE=checked01.fs SCFLAGS="--checked+" # fsc-checked+ - SOURCE=unchecked01.fs SCFLAGS="--checked-" # fsc-checked- - - SOURCE=unchecked01.fs FSIMODE=EXEC COMPILE_ONLY=1 # fsi-default - SOURCE=checked01.fs SCFLAGS="--checked" FSIMODE=EXEC COMPILE_ONLY=1 # fsi-checked - SOURCE=checked01.fs SCFLAGS="--checked+" FSIMODE=EXEC COMPILE_ONLY=1 # fsi-checked+ - SOURCE=unchecked01.fs SCFLAGS="--checked-" FSIMODE=EXEC COMPILE_ONLY=1 # fsi-checked- - -# Last one wins - SOURCE=checked01.fs SCFLAGS="--checked --checked+" # fsc-checkedchecked+ - SOURCE=checked01.fs SCFLAGS="--checked- --checked+" # fsc-checked-checked+ - SOURCE=unchecked01.fs SCFLAGS="--checked+ --checked-" # fsc-checked+checked- - - SOURCE=checked01.fs SCFLAGS="--checked --checked+" FSIMODE=EXEC COMPILE_ONLY=1 # fsi-checkedchecked+ - SOURCE=checked01.fs SCFLAGS="--checked- --checked+" FSIMODE=EXEC COMPILE_ONLY=1 # fsi-checked-checked+ - SOURCE=unchecked01.fs SCFLAGS="--checked+ --checked-" FSIMODE=EXEC COMPILE_ONLY=1 # fsi-checked+checked- - -# Unrecognized argument - SOURCE=unrecogarg.fs SCFLAGS="--Checked" # fsc--Checked - SOURCE=unrecogarg.fs SCFLAGS="--checked*" # fsc--checked* - - SOURCE=unrecogarg.fs SCFLAGS="--Checked" FSIMODE=EXEC COMPILE_ONLY=1 # fsi--Checked - SOURCE=unrecogarg.fs SCFLAGS="--checked*" FSIMODE=EXEC COMPILE_ONLY=1 # fsi--checked* - - - SOURCE=UncheckedDefaultOf01.fs # UncheckedDefaultOf01 From 02a4f8d4d9b3b84a8bf7cb447ca9bf4c7883b5ce Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Tue, 8 Nov 2022 13:32:19 -0800 Subject: [PATCH 2/5] net7.0 --- tests/FSharp.Test.Utilities/CompilerAssert.fs | 2 +- .../FSharp.Test.Utilities.fsproj | 25 ------------------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/tests/FSharp.Test.Utilities/CompilerAssert.fs b/tests/FSharp.Test.Utilities/CompilerAssert.fs index c526d83da7..eb9ea5d3a3 100644 --- a/tests/FSharp.Test.Utilities/CompilerAssert.fs +++ b/tests/FSharp.Test.Utilities/CompilerAssert.fs @@ -565,7 +565,7 @@ module rec CompilerAssertHelpers = "tfm": "net7.0", "framework": { "name": "Microsoft.NETCore.App", - "version": "6.0" + "version": "7.0" } } }""" diff --git a/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj b/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj index aac6dca42d..45ecc07619 100644 --- a/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj +++ b/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj @@ -61,31 +61,6 @@ - - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - From 49e06ff346cfd2a82ad0ea5a53eb354b9741ea86 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Tue, 8 Nov 2022 16:51:52 -0800 Subject: [PATCH 3/5] tweak --- tests/FSharp.Test.Utilities/Utilities.fs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/FSharp.Test.Utilities/Utilities.fs b/tests/FSharp.Test.Utilities/Utilities.fs index 96b8e352e5..f74faf49fa 100644 --- a/tests/FSharp.Test.Utilities/Utilities.fs +++ b/tests/FSharp.Test.Utilities/Utilities.fs @@ -120,7 +120,6 @@ module Utilities = $TARGETFRAMEWORK true true - $DOTNETFSCCOMPILERPATH @@ -171,7 +170,6 @@ let main argv = 0""" let pathToTemp = Path.Combine(pathToArtifacts, "Temp") let projectDirectory = Path.Combine(pathToTemp,Guid.NewGuid().ToString() + ".tmp") let pathToFSharpCore = typeof.Assembly.Location - let dotNetFscCompilerPath = config.DOTNETFSCCOMPILERPATH try try Directory.CreateDirectory(projectDirectory) |> ignore @@ -181,9 +179,9 @@ let main argv = 0""" let directoryBuildTargetsFileName = Path.Combine(projectDirectory, "Directory.Build.targets") let frameworkReferencesFileName = Path.Combine(projectDirectory, "FrameworkReferences.txt") #if NETCOREAPP - File.WriteAllText(projectFileName, projectFile.Replace("$TARGETFRAMEWORK", "net7.0").Replace("$FSHARPCORELOCATION", pathToFSharpCore).Replace("$DOTNETFSCCOMPILERPATH", dotNetFscCompilerPath)) + File.WriteAllText(projectFileName, projectFile.Replace("$TARGETFRAMEWORK", "net7.0").Replace("$FSHARPCORELOCATION", pathToFSharpCore)) #else - File.WriteAllText(projectFileName, projectFile.Replace("$TARGETFRAMEWORK", "net472").Replace("$FSHARPCORELOCATION", pathToFSharpCore).Replace("$DOTNETFSCCOMPILERPATH", dotNetFscCompilerPath)) + File.WriteAllText(projectFileName, projectFile.Replace("$TARGETFRAMEWORK", "net472").Replace("$FSHARPCORELOCATION", pathToFSharpCore)) #endif File.WriteAllText(programFsFileName, programFs) File.WriteAllText(directoryBuildPropsFileName, directoryBuildProps) From 41811891c72e294d437c74a3c5c7aa01cfd42700 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Tue, 8 Nov 2022 18:30:32 -0800 Subject: [PATCH 4/5] cliversion --- .../CompilerOptions/fsc/cliversion.fs | 36 +++++++++++++++++++ .../FSharp.Compiler.ComponentTests.fsproj | 1 + .../fsc/cliversion/E_fsc_cliversion.fs | 3 -- .../fsc/cliversion/E_fsi_cliversion.fs | 3 -- .../CompilerOptions/fsc/cliversion/env.lst | 3 -- 5 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/cliversion.fs delete mode 100644 tests/fsharpqa/Source/CompilerOptions/fsc/cliversion/E_fsc_cliversion.fs delete mode 100644 tests/fsharpqa/Source/CompilerOptions/fsc/cliversion/E_fsi_cliversion.fs delete mode 100644 tests/fsharpqa/Source/CompilerOptions/fsc/cliversion/env.lst diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/cliversion.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/cliversion.fs new file mode 100644 index 0000000000..3ebf04a5f5 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/cliversion.fs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.ComponentTests.CompilerOptions + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +module cliversion = + + //# SOURCE=E_fsc_cliversion.fs SCFLAGS="--cliversion:2.0" # fsc --cliversion:2.0 + [] + let ``fsc --cliversion:2.0``() = + FSharp """ + """ + |> asExe + |> withOptions ["--cliversion:2.0"] + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 243, Line 0, Col 1, Line 0, Col 1, "Unrecognized option: '--cliversion'") + ] + + //# SOURCE=E_fsi_cliversion.fs SCFLAGS="--cliversion:2.0" FSIMODE=EXEC COMPILE_ONLY=1 # fsi --cliversion:2.0 + [] + let ``fsi --cliversion:2.0``() = + FSharp """ + """ + |> asFsx + |> withOptions ["--cliversion:2.0"] + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 243, Line 0, Col 1, Line 0, Col 1, "Unrecognized option: '--cliversion'") + ] + diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index fbc15aac23..f32d64f7af 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -186,6 +186,7 @@ + diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/cliversion/E_fsc_cliversion.fs b/tests/fsharpqa/Source/CompilerOptions/fsc/cliversion/E_fsc_cliversion.fs deleted file mode 100644 index 572eed4b5b..0000000000 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/cliversion/E_fsc_cliversion.fs +++ /dev/null @@ -1,3 +0,0 @@ -// #Regression #NoMT #CompilerOptions -//Unrecognized option: '--cliversion' -exit 0 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/cliversion/E_fsi_cliversion.fs b/tests/fsharpqa/Source/CompilerOptions/fsc/cliversion/E_fsi_cliversion.fs deleted file mode 100644 index 31762bba37..0000000000 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/cliversion/E_fsi_cliversion.fs +++ /dev/null @@ -1,3 +0,0 @@ -// #Regression #NoMT #CompilerOptions -//Unrecognized option: '--cliversion' -#q;; diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/cliversion/env.lst b/tests/fsharpqa/Source/CompilerOptions/fsc/cliversion/env.lst deleted file mode 100644 index 0255f13740..0000000000 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/cliversion/env.lst +++ /dev/null @@ -1,3 +0,0 @@ - SOURCE=E_fsc_cliversion.fs SCFLAGS="--cliversion:2.0" # fsc --cliversion:2.0 - SOURCE=E_fsi_cliversion.fs SCFLAGS="--cliversion:2.0" FSIMODE=EXEC COMPILE_ONLY=1 # fsi --cliversion:2.0 - From 816a507961b79f5e838e39842610037055f1b4e7 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Tue, 8 Nov 2022 22:03:49 -0800 Subject: [PATCH 5/5] foo --- .../FSharp.Test.Utilities.fsproj | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj b/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj index 45ecc07619..a219a73c7f 100644 --- a/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj +++ b/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj @@ -61,6 +61,31 @@ + + + + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always +