From 32b9db196d15ad69b9239270cc148e68741e074e Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Tue, 7 Jan 2025 09:08:28 -0800 Subject: [PATCH 1/2] More tests - directory attribute improvements --- .../CompilerOptions/fsc/checked/checked.fs | 119 +-- .../CompilerOptions/fsc/codepage/codepage.fs | 47 +- .../fsc/noframework/noframework.fs | 5 +- .../CompilerOptions/fsc/platform/platform.fs | 47 +- .../CompilerOptions/fsc/times/times.fs | 18 +- .../CompilerOptions/fsc/warn/warn.fs | 47 +- .../CompilerOptions/fsc/warnon/warnon.fs | 8 +- .../BasicGrammarElements/MethodResolution.fs | 485 ------------- .../BasicApplication/BasicApplication.fs | 9 +- .../BindingExpressions/BindingExpressions.fs | 45 +- .../PatternMatching/PatternMatching.fs | 9 +- .../SequenceIteration/SequenceIteration.fs | 3 +- .../Type-relatedExpressions.fs | 15 +- .../Attributes/Diags/Attributes_Diags.fs | 6 +- .../Attributes/Legacy/Attributes_Legacy.fs | 84 ++- .../Attributes/New/Attributes_New.fs | 84 ++- .../Basic/Basic.fs | 63 +- .../IComparison/IComparison.fs | 12 +- .../ByrefSafetyAnalysis.fs | 284 +++++--- .../RecursiveSafetyAnalysis.fs | 30 +- .../LexicalFiltering/HashLight/HashLight.fs | 3 +- .../HighPrecedenceApplication.fs | 3 +- .../OffsideExceptions/OffsideExceptions.fs | 15 +- .../Conformance/PatternMatching/And/And.fs | 15 +- .../PatternMatching/Array/Array.fs | 12 +- .../Conformance/PatternMatching/As/As.fs | 6 +- .../PatternMatching/ConsList/ConsList.fs | 12 +- .../PatternMatching/Decimal/Decimal.fs | 3 +- .../DynamicTypeTest/DynamicTypeTest.fs | 81 ++- .../PatternMatching/Expression/Expression.fs | 51 +- .../PatternMatching/Named/Named.fs | 205 +++--- .../Conformance/PatternMatching/Null/Null.fs | 6 +- .../PatternMatching/Record/Record.fs | 27 +- .../PatternMatching/Simple/Simple.fs | 145 ++-- .../SimpleConstant/SimpleConstant.fs | 63 +- .../PatternMatching/Wildcard/Wildcard.fs | 3 +- .../PseudoCustomAttributes.fs | 26 +- .../Types/RecordTypes/RecordTypes.fs | 144 ++-- .../Types/StructTypes/StructTypes.fs | 12 +- .../CheckingSyntacticTypes.fs | 6 +- .../IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs | 5 +- .../LogicalPropertiesOfTypes.fs | 3 +- .../Types/UnionTypes/UnionTypes.fs | 183 +++-- .../ConstraintSolver/PrimitiveConstraints.fs | 5 +- .../UnionCasePatternMatchingErrors.fs | 334 ++++----- .../FSharp.Compiler.ComponentTests.fsproj | 2 +- .../Globalization/GlobalizationTestCases.fs | 25 +- .../SequenceExpressionTests.fs | 687 +++++++++--------- .../Miscellaneous/ListLiterals.fs | 8 +- .../OCamlCompat/OCamlCompat.fs | 42 +- 50 files changed, 1825 insertions(+), 1727 deletions(-) delete mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution.fs diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked.fs index 4e4902c63d3..8a0447a450e 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked.fs @@ -9,71 +9,79 @@ open Xunit module Checked = // SOURCE=unchecked01.fs # fsc-default - [] - let ``fsc-unchecked - unchecked01_fs`` compilation = - compilation + [] + let ``fsc-unchecked - unchecked01_fs`` compilation = + compilation + |> getCompilation |> asFs |> compile |> shouldSucceed // SOURCE=checked01.fs SCFLAGS="--checked" # fsc-checked - [] - let ``fsc-unchecked - unchecked01_fs --checked`` compilation = - compilation + [] + let ``fsc-unchecked - unchecked01_fs --checked`` compilation = + compilation + |> getCompilation |> asFs |> withOptions["--checked"] |> compile |> shouldSucceed // SOURCE=checked01.fs SCFLAGS="--checked+" # fsc-checked+ - [] - let ``fsc-unchecked - unchecked01_fs --checked+`` compilation = - compilation + [] + let ``fsc-unchecked - unchecked01_fs --checked+`` compilation = + compilation + |> getCompilation |> asFs |> withOptions["--checked+"] |> compile |> shouldSucceed // SOURCE=unchecked01.fs SCFLAGS="--checked-" # fsc-checked- - [] - let ``fsc-unchecked - unchecked01_fs --checked-`` compilation = - compilation + [] + let ``fsc-unchecked - unchecked01_fs --checked-`` compilation = + compilation + |> getCompilation |> asFs |> withOptions["--checked-"] |> compile |> shouldSucceed // SOURCE=unchecked01.fs SCFLAGS="--checked-" # fsc-checked- - [] - let ``fsi-unchecked - unchecked01_fs --checked-`` compilation = - compilation + [] + let ``fsi-unchecked - unchecked01_fs --checked-`` compilation = + compilation + |> getCompilation |> 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 + [] + let ``fsi-checked - checked01_fs --checked`` compilation = + compilation + |> getCompilation |> 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 + [] + let ``fsi-checked - checked01_fs --checked+`` compilation = + compilation + |> getCompilation |> 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 + [] + let ``fsi-checked - checked01_fs --checked-`` compilation = + compilation + |> getCompilation |> asFsx |> withOptions["--checked-"] |> compile @@ -83,54 +91,60 @@ module Checked = //# Last one wins // SOURCE=checked01.fs SCFLAGS="--checked --checked+" # fsc-checkedchecked+ - [] - let ``fsc-checked - checked01_fs --checked --checked+`` compilation = - compilation + [] + let ``fsc-checked - checked01_fs --checked --checked+`` compilation = + compilation + |> getCompilation |> asFs |> withOptions["--checked"; "--checked+"] |> compile |> shouldSucceed // SOURCE=checked01.fs SCFLAGS="--checked- --checked+" # fsc-checked-checked+ - [] - let ``fsc-checked - checked01_fs --checked- --checked+`` compilation = - compilation + [] + let ``fsc-checked - checked01_fs --checked- --checked+`` compilation = + compilation + |> getCompilation |> asFs |> withOptions["--checked-"; "--checked+"] |> compile |> shouldSucceed // SOURCE=unchecked01.fs SCFLAGS="--checked+ --checked-" # fsc-checked+checked- - [] - let ``fsc-checked - unchecked01_fs --checked+ --checked-`` compilation = - compilation + [] + let ``fsc-checked - unchecked01_fs --checked+ --checked-`` compilation = + compilation + |> getCompilation |> asFs |> withOptions["--checked+"; "--checked-"] |> compile |> shouldSucceed // SOURCE=checked01.fs SCFLAGS="--checked --checked+" # fsc-checkedchecked+ - [] - let ``fsi-checked - checked01_fs --checked --checked+`` compilation = - compilation + [] + let ``fsi-checked - checked01_fs --checked --checked+`` compilation = + compilation + |> getCompilation |> asFsx |> withOptions["--checked"; "--checked+"] |> compile |> shouldSucceed // SOURCE=checked01.fs SCFLAGS="--checked- --checked+" # fsc-checked-checked+ - [] - let ``fsi-checked - checked01_fs --checked- --checked+`` compilation = - compilation + [] + let ``fsi-checked - checked01_fs --checked- --checked+`` compilation = + compilation + |> getCompilation |> asFsx |> withOptions["--checked-"; "--checked+"] |> compile |> shouldSucceed // SOURCE=unchecked01.fs SCFLAGS="--checked+ --checked-" # fsc-checked+checked- - [] - let ``fsi-checked - unchecked01_fs --checked+ --checked-`` compilation = - compilation + [] + let ``fsi-checked - unchecked01_fs --checked+ --checked-`` compilation = + compilation + |> getCompilation |> asFsx |> withOptions["--checked+"; "--checked-"] |> compile @@ -138,9 +152,10 @@ module Checked = //# Unrecognized argument // SOURCE=unrecogarg.fs SCFLAGS="--Checked" # fsc--Checked - [] - let ``fsc-checked - unchecked01_fs Checked`` compilation = - compilation + [] + let ``fsc-checked - unchecked01_fs Checked`` compilation = + compilation + |> getCompilation |> asFs |> withOptions["--Checked"] |> compile @@ -150,9 +165,10 @@ module Checked = ] // SOURCE=unrecogarg.fs SCFLAGS="--checked*" # fsc--checked* - [] - let ``fsc-checked - unchecked01_fs --checked-star`` compilation = - compilation + [] + let ``fsc-checked - unchecked01_fs --checked-star`` compilation = + compilation + |> getCompilation |> asFs |> withOptions["--checked*"] |> compile @@ -162,9 +178,10 @@ module Checked = ] // SOURCE=unrecogarg.fs SCFLAGS="--checked*" # fsc--checked* - [] - let ``fsc-checked - UncheckedDefaultOf01`` compilation = - compilation + [] + let ``fsc-checked - UncheckedDefaultOf01`` compilation = + compilation + |> getCompilation |> asFs |> asExe |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/codepage.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/codepage.fs index 536083be938..6321b99fd07 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/codepage.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/codepage/codepage.fs @@ -8,22 +8,22 @@ open FSharp.Test.Compiler open System open System.IO -module codepage = +module Codepage = let libCodepage1250 = - FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, "libCodepage.fs")) + FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, "libCodepage.fs")) |> withCodepage "1250" |> withName "libCodepage1250" |> asLibrary let libCodepage1251 = - FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, "libCodepage.fs")) + FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, "libCodepage.fs")) |> withCodepage "1251" |> withName "libCodepage1251" |> asLibrary let secondLibCodepage1250 = - FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, "libCodepage.fs")) + FsFromPath (Path.Combine(__SOURCE_DIRECTORY__, "libCodepage.fs")) |> withCodepage "1250" |> withName "secondLibCodepage1250" |> asLibrary @@ -31,9 +31,10 @@ module codepage = #if NETFRAMEWORK - [] + [] let ``Reference assembly compiled with same codepages`` compilation = compilation + |> getCompilation |> asExe |> withReferences [ libCodepage1250; secondLibCodepage1250 ] |> compile @@ -42,9 +43,10 @@ module codepage = (Error 39, Line 11, Col 13, Line 11, Col 14, "The value, constructor, namespace or type 'б' is not defined.") ] - [] + [] let ``Reference assembly compiled with different codepages`` compilation = compilation + |> getCompilation |> asExe |> withReferences [ libCodepage1250; libCodepage1251 ] |> compileAndRun @@ -53,9 +55,10 @@ module codepage = //# Boundary case // SOURCE=E_NoDataForEncoding65535.fs SCFLAGS="--codepage:65535" # E_NoDataForEncoding65535.fs - [] + [] let ``Reference assembly compiled with no data for codepage`` compilation = compilation + |> getCompilation |> withCodepage "65535" |> asExe |> compile @@ -66,9 +69,10 @@ module codepage = //# Boundary case // SOURCE=Zero.fs SCFLAGS="--codepage:0x0" # Zero.fs - [] + [] let ``Reference assembly compiled with zero for codepage`` compilation = compilation + |> getCompilation |> withNoWarn 52 |> withCodepage "0x0" |> asExe @@ -78,9 +82,10 @@ module codepage = //# Negative cases // SOURCE=E_OutOfRangeArgument01.fs SCFLAGS="--codepage:65536" # E_OutOfRangeArgument01.fs - [] + [] let ``OutOfRangeArgument01_fs`` compilation = compilation + |> getCompilation |> asExe |> withCodepage "65536" |> compile @@ -95,9 +100,10 @@ Parameter name: codepage") ] // SOURCE=E_OutOfRangeArgument01.fs SCFLAGS="--codepage:65536" FSIMODE=EXEC # E_OutOfRangeArgument01.fs-fsi - [] + [] let ``E_OutOfRangeArgument01_fsx`` compilation = compilation + |> getCompilation |> asFsx |> withCodepage "65536" |> compile @@ -112,9 +118,10 @@ Parameter name: codepage") ] // SOURCE=E_NegativeArgument01.fs SCFLAGS="--codepage:-1" # E_NegativeArgument01.fs - [] + [] let ``E_NegativeArgument01_fs`` compilation = compilation + |> getCompilation |> asExe |> withCodepage "-1" |> compile @@ -129,9 +136,10 @@ Parameter name: codepage") ] // SOURCE=E_NegativeArgument01.fs SCFLAGS="--codepage:-1" FSIMODE=EXEC # E_NegativeArgument01.fs-fsi - [] + [] let ``E_NegativeArgument01_fsx`` compilation = compilation + |> getCompilation |> asFsx |> withCodepage "-1" |> compile @@ -146,9 +154,10 @@ Parameter name: codepage") ] // SOURCE=E_NotAValidInteger01.fs SCFLAGS="--codepage:invalidinteger" # E_NotAValidInteger01.fs - [] + [] let ``E_NotAValidInteger01_fs`` compilation = compilation + |> getCompilation |> asExe |> withCodepage "invalidinteger" |> compile @@ -158,9 +167,10 @@ Parameter name: codepage") ] // SOURCE=E_NotAValidInteger01.fs SCFLAGS="--codepage:invalidinteger" FSIMODE=EXEC # E_NotAValidInteger01.fs-fsi - [] + [] let ``E_NotAValidInteger01_fsx`` compilation = compilation + |> getCompilation |> asFsx |> withCodepage "invalidinteger" |> compile @@ -170,9 +180,10 @@ Parameter name: codepage") ] // SOURCE=E_RequiresParameter01.fs TAILFLAGS="--codepage" # E_RequiresParameter01.fs - [] + [] let ``E_RequiresParameter01_fs`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--codepage"] |> compile @@ -182,9 +193,10 @@ Parameter name: codepage") ] // SOURCE=E_RequiresParameter01.fs TAILFLAGS="--codepage" FSIMODE=EXEC # E_RequiresParameter01.fs-fsi - [] + [] let ``E_RequiresParameter01_fsx`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--codepage"] |> compile @@ -194,9 +206,10 @@ Parameter name: codepage") ] // SOURCE=E_DefaultCodePage02.fsx COMPILE_ONLY=1 # E_DefaultCodePage02.fsx - [] + [] let ``libCodepage_fs`` compilation = compilation + |> getCompilation |> asLibrary |> compile |> shouldFail diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/noframework/noframework.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/noframework/noframework.fs index 7847debd5a7..4b046928e9d 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/noframework/noframework.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/noframework/noframework.fs @@ -6,13 +6,14 @@ open Xunit open FSharp.Test open FSharp.Test.Compiler -module noframework = +module Noframework = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/noframework) // - [] + [] let ``noframework - noframework02_fs - --noframework`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--noframework"] |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/platform.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/platform.fs index 9b320af3d8a..e52f293e8cf 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/platform.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/platform/platform.fs @@ -6,13 +6,14 @@ open Xunit open FSharp.Test open FSharp.Test.Compiler -module platform = +module Platform = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - [] + [] let ``platform - error_16_fs - --target:library --platform:anycpu32bitpreferred`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--target:library"; "--platform:anycpu32bitpreferred"] |> compile @@ -23,9 +24,10 @@ module platform = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - [] + [] let ``platform - error_01_fs - --PLATFORM:anycpu`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--PLATFORM:anycpu"] |> compile @@ -36,9 +38,10 @@ module platform = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - [] + [] let ``platform - error_02_fs - --PlatForm:anycpu`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--PlatForm:anycpu"] |> compile @@ -49,9 +52,10 @@ module platform = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - [] + [] let ``platform - error_03_fs - --platform:ITANIUM`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--platform:ITANIUM"] |> compile @@ -62,9 +66,10 @@ module platform = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - [] + [] let ``platform - error_04_fs - --platform:ANYCPU`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--platform:ANYCPU"] |> compile @@ -75,9 +80,10 @@ module platform = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - [] + [] let ``platform - error_05_fs - --platform:X86`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--platform:X86"] |> compile @@ -88,9 +94,10 @@ module platform = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - [] + [] let ``platform - error_06_fs - --platform:X64`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--platform:X64"] |> compile @@ -101,9 +108,10 @@ module platform = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - [] + [] let ``platform - error_07_fs - --platform:IA64`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--platform:IA64"] |> compile @@ -114,9 +122,10 @@ module platform = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - [] + [] let ``platform - error_08_fs - --platform:i386`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--platform:i386"] |> compile @@ -127,9 +136,10 @@ module platform = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - [] + [] let ``platform - error_09_fs - --platform:AMD64`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--platform:AMD64"] |> compile @@ -140,9 +150,10 @@ module platform = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - [] + [] let ``platform - error_10_fs - --platform:PPC`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--platform:PPC"] |> compile @@ -153,9 +164,10 @@ module platform = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - [] + [] let ``platform - error_15_fs - --platform:ARM`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--platform:ARM"] |> compile @@ -166,9 +178,10 @@ module platform = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - [] + [] let ``platform - error_11_fs - --platform-:anycpu`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--platform-:anycpu"] |> compile @@ -179,9 +192,10 @@ module platform = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - [] + [] let ``platform - error_12_fs - --PLATFORM+:anycpu`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--PLATFORM+:anycpu"] |> compile @@ -192,9 +206,10 @@ module platform = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/platform) - [] + [] let ``platform - error_13_fs - ---platform:anycpu`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["---platform:anycpu"] |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/times.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/times.fs index 7b137c24c15..6e4847ee498 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/times.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/times/times.fs @@ -10,13 +10,14 @@ open System.IO // reportTime uses global state. [] -module times = +module Times = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/times) - [] + [] let ``times - error_01_fs - --Times`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--Times"] |> typecheck @@ -27,9 +28,10 @@ module times = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/times) - [] + [] let ``times - error_02_fs - --times-`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--times-"] |> typecheck @@ -40,9 +42,10 @@ module times = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/times) - [] + [] let ``times - error_03_fs - --times+`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--times+"] |> typecheck @@ -51,9 +54,10 @@ module times = |> withDiagnosticMessageMatches "Unrecognized option: '--times\+'" |> ignore - [] + [] let ``times - to console`` compilation = compilation + |> getCompilation |> asFsx |> withBufferWidth 120 |> withOptions ["--times"] @@ -66,13 +70,15 @@ module times = "Duration"|] - [] + [] + [] let ``times - to csv file`` compilation = let tempPath = Path.Combine(Path.GetTempPath(),Guid.NewGuid().ToString() + ".csv") use _ = {new IDisposable with member this.Dispose() = File.Delete(tempPath) } compilation + |> getCompilation |> asFsx |> withOptions ["--times:"+tempPath] |> ignoreWarnings diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn.fs index 9dd6dea0e91..153bff74a70 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warn/warn.fs @@ -6,11 +6,12 @@ open Xunit open FSharp.Test open FSharp.Test.Compiler -module TestCompilerWarningLevel = +module CompilerWarningLevel = - [] + [] let ``warn_level0_fs --warn:0`` compilation = compilation + |> getCompilation |> withLangVersion80 |> asExe |> withOptions ["--warn:0"] @@ -18,41 +19,46 @@ module TestCompilerWarningLevel = |> shouldSucceed |> withDiagnostics [] - [] + [] let ``warn_level1_fs --warn:1 --warnaserror:52`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--warn:1"; "--warnaserror:52"] |> compile |> shouldSucceed - [] + [] let ``warn_level2_fs --warn:2 --warnaserror:52`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--warn:2"; "--warnaserror:52"] |> compile |> shouldSucceed - [] + [] let ``warn_level3_fs --warn:3 --warnaserror:52`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--warn:3"; "--warnaserror:52"] |> compile |> shouldSucceed - [] + [] let ``warn_level4_fs --warn:4 --warnaserror:52`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--warn:4"; "--warnaserror:52"] |> compile |> shouldSucceed - [] + [] let ``warn_level5_fs --warn:5 --warnaserror:52`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--warn:5"; "--warnaserror:52"] |> compile @@ -61,9 +67,10 @@ module TestCompilerWarningLevel = |> withDiagnosticMessageMatches "The value has been copied to ensure the original is not mutated by this operation or because the copy is implicit when returning a struct from a member and another member is then accessed$" |> ignore - [] + [] let ``warn_level5_fs --warn:5`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--warn:5"] |> compile @@ -74,9 +81,10 @@ module TestCompilerWarningLevel = #if NETSTANDARD // This test works with KeyValuePair, which is not a 'readonly struct' in net472 - [] + [] let ``no error 52 with readonly struct`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--warn:5"; "--warnaserror:52"] |> compile @@ -84,9 +92,10 @@ module TestCompilerWarningLevel = |> ignore #endif - [] + [] let ``warn_level6_fs --warn:6`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--warn:6"] |> compile @@ -95,18 +104,20 @@ module TestCompilerWarningLevel = |> withDiagnosticMessageMatches "Invalid warning level '6'" |> ignore - [] + [] let ``nowarn_fs --warnaserror`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--warnaserror"] |> compileAndRun |> shouldSucceed |> ignore - [] + [] let ``warn40_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -117,9 +128,10 @@ module TestCompilerWarningLevel = ] |> ignore - [] + [] let ``warn40_fs --warnaserror`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--warnaserror"] |> compile @@ -131,27 +143,30 @@ module TestCompilerWarningLevel = ] |> ignore - [] + [] let ``warn40_fs --nowarn:40;21`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--nowarn:40;21"] |> compileAndRun |> shouldSucceed |> ignore - [] + [] let ``warn40_fs --nowarn:NU0000;FS40;NU0001`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--nowarn:NU0000;FS40;NU0001;FS21"] |> compileAndRun |> shouldSucceed |> ignore - [] + [] let ``warn40_fs --nowarn:FS0040`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--nowarn:FS0040"; "--nowarn:FS0021"] |> compileAndRun diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warnon/warnon.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warnon/warnon.fs index 130c7058c6f..c726ecbde87 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warnon/warnon.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/warnon/warnon.fs @@ -6,13 +6,14 @@ open Xunit open FSharp.Test open FSharp.Test.Compiler -module warnon = +module CompilerWarnOn = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/warnon) //The value 'n' is unused$ - [] + [] let ``warnon - warnon01_fs - --warnon:1182 --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--warnon:1182"; "--test:ErrorRanges"] |> compile @@ -23,9 +24,10 @@ module warnon = // This test was automatically generated (moved from FSharpQA suite - CompilerOptions/fsc/warnon) //The value 'n' is unused$ - [] + [] let ``warnon - warnon01_fs - --warnon:NU0001;FS1182;NU0001 --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--warnon:NU0001;FS1182;NU0001"; "--test:ErrorRanges"] |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution.fs deleted file mode 100644 index f6145c01abc..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution.fs +++ /dev/null @@ -1,485 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace Conformance.BasicGrammarElements - -open Xunit -open FSharp.Test.Compiler - -module MethodResolution = - - [] - let ``Method with optional and out parameters resolves correctly (sanity test)`` () = - FSharp """ -open System.Runtime.InteropServices - -type Thing = - static member Do(o: outref, []i: int) = - o <- i - i = 7 - -// We expect return value to be false, and out value to be 42 here. -let returnvalue1, value1 = Thing.Do(i = 42) -// Have explicit boolean check for readability here: -if returnvalue1 <> false && value1 <> 42 then - failwith "Mismatch: Return value should be false, and out value should be 42" - -// Here, we expect return value to be true, and out value to be 7 -let returnvalue2, value2 = Thing.Do() -// Have explicit boolean check for readability here: -if returnvalue2<> true && value2 <> 7 then - failwith "Mismatch: Return value should be true, and out value should be 7" - """ - |> typecheck - |> shouldSucceed - |> ignore - - [] - let ``Method with optional and out parameters resolves correctly withRealInternalSignatureOff (verify IL)`` () = - FSharp """ -module OutOptionalTests -open System.Runtime.InteropServices - -type Thing = - static member Do(o: outref, []i: int) = - o <- i - i = 7 -let (_:bool), (_:int) = Thing.Do(i = 42) -let (_:bool), (_:int) = Thing.Do() - """ - |> ignoreWarnings - |> withRealInternalSignatureOff - |> compile - |> shouldSucceed - |> verifyIL [ - """ -.class public abstract auto ansi sealed OutOptionalTests -extends [runtime]System.Object -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .class auto ansi serializable nested public Thing - extends [runtime]System.Object - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) - .method public static bool Do([out] int32& o, - [opt] int32 i) cil managed - { - .param [2] = int32(0x00000001) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldarg.1 - IL_0002: stobj [runtime]System.Int32 - IL_0007: ldarg.1 - IL_0008: ldc.i4.7 - IL_0009: ceq - IL_000b: ret - } - - } - - .method assembly specialname static class [runtime]System.Tuple`2 get_patternInput@9() cil managed - { - - .maxstack 8 - IL_0000: ldsfld class [runtime]System.Tuple`2 ''.$OutOptionalTests::patternInput@9 - IL_0005: ret - } - - .method assembly specialname static int32 get_outArg@9() cil managed - { - - .maxstack 8 - IL_0000: ldsfld int32 ''.$OutOptionalTests::outArg@9 - IL_0005: ret - } - - .method assembly specialname static void set_outArg@9(int32 'value') cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: stsfld int32 ''.$OutOptionalTests::outArg@9 - IL_0006: ret - } - - .method assembly specialname static class [runtime]System.Tuple`2 'get_patternInput@10-1'() cil managed - { - - .maxstack 8 - IL_0000: ldsfld class [runtime]System.Tuple`2 ''.$OutOptionalTests::'patternInput@10-1' - IL_0005: ret - } - - .method assembly specialname static int32 'get_outArg@10-1'() cil managed - { - - .maxstack 8 - IL_0000: ldsfld int32 ''.$OutOptionalTests::'outArg@10-1' - IL_0005: ret - } - - .method assembly specialname static void 'set_outArg@10-1'(int32 'value') cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: stsfld int32 ''.$OutOptionalTests::'outArg@10-1' - IL_0006: ret - } - - .property class [runtime]System.Tuple`2 - patternInput@9() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .get class [runtime]System.Tuple`2 OutOptionalTests::get_patternInput@9() - } - .property int32 outArg@9() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .set void OutOptionalTests::set_outArg@9(int32) - .get int32 OutOptionalTests::get_outArg@9() - } - .property class [runtime]System.Tuple`2 - 'patternInput@10-1'() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .get class [runtime]System.Tuple`2 OutOptionalTests::'get_patternInput@10-1'() - } - .property int32 'outArg@10-1'() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .set void OutOptionalTests::'set_outArg@10-1'(int32) - .get int32 OutOptionalTests::'get_outArg@10-1'() - } -} - """ - """ -.class private abstract auto ansi sealed ''.$OutOptionalTests -extends [runtime]System.Object -{ - .field static assembly initonly class [runtime]System.Tuple`2 patternInput@9 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .field static assembly int32 outArg@9 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .field static assembly initonly class [runtime]System.Tuple`2 'patternInput@10-1' - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .field static assembly int32 'outArg@10-1' - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 4 - .locals init (int32& V_0) - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$OutOptionalTests::outArg@9 - IL_0006: ldsflda int32 ''.$OutOptionalTests::outArg@9 - IL_000b: stloc.0 - IL_000c: ldloc.0 - IL_000d: ldc.i4.s 42 - IL_000f: stobj [runtime]System.Int32 - IL_0014: ldc.i4.0 - IL_0015: call int32 OutOptionalTests::get_outArg@9() - IL_001a: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_001f: stsfld class [runtime]System.Tuple`2 ''.$OutOptionalTests::patternInput@9 - IL_0024: ldc.i4.0 - IL_0025: stsfld int32 ''.$OutOptionalTests::'outArg@10-1' - IL_002a: ldsflda int32 ''.$OutOptionalTests::'outArg@10-1' - IL_002f: stloc.0 - IL_0030: ldloc.0 - IL_0031: ldc.i4.1 - IL_0032: stobj [runtime]System.Int32 - IL_0037: ldc.i4.0 - IL_0038: call int32 OutOptionalTests::'get_outArg@10-1'() - IL_003d: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_0042: stsfld class [runtime]System.Tuple`2 ''.$OutOptionalTests::'patternInput@10-1' - IL_0047: ret - } - -} - """] - - [] - let ``Method with optional and out parameters resolves correctly withRealInternalSignatureOn (verify IL)`` () = - FSharp """ -module OutOptionalTests -open System.Runtime.InteropServices - -type Thing = - static member Do(o: outref, []i: int) = - o <- i - i = 7 -let (_:bool), (_:int) = Thing.Do(i = 42) -let (_:bool), (_:int) = Thing.Do() - """ - |> ignoreWarnings - |> withRealInternalSignatureOn - |> compile - |> shouldSucceed - |> verifyIL [ - """ -.class public abstract auto ansi sealed OutOptionalTests - extends [runtime]System.Object -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .class auto ansi serializable nested public Thing - extends [runtime]System.Object - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) - .method public static bool Do([out] int32& o, - [opt] int32 i) cil managed - { - .param [2] = int32(0x00000001) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldarg.1 - IL_0002: stobj [runtime]System.Int32 - IL_0007: ldarg.1 - IL_0008: ldc.i4.7 - IL_0009: ceq - IL_000b: ret - } - - } - - .field static assembly class [runtime]System.Tuple`2 patternInput@9 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .field static assembly int32 outArg@9 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .field static assembly class [runtime]System.Tuple`2 'patternInput@10-1' - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .field static assembly int32 'outArg@10-1' - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method assembly specialname static class [runtime]System.Tuple`2 get_patternInput@9() cil managed - { - - .maxstack 8 - IL_0000: ldsfld class [runtime]System.Tuple`2 OutOptionalTests::patternInput@9 - IL_0005: ret - } - - .method assembly specialname static int32 get_outArg@9() cil managed - { - - .maxstack 8 - IL_0000: ldsfld int32 OutOptionalTests::outArg@9 - IL_0005: ret - } - - .method assembly specialname static void set_outArg@9(int32 'value') cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: stsfld int32 OutOptionalTests::outArg@9 - IL_0006: ret - } - - .method assembly specialname static class [runtime]System.Tuple`2 'get_patternInput@10-1'() cil managed - { - - .maxstack 8 - IL_0000: ldsfld class [runtime]System.Tuple`2 OutOptionalTests::'patternInput@10-1' - IL_0005: ret - } - - .method assembly specialname static int32 'get_outArg@10-1'() cil managed - { - - .maxstack 8 - IL_0000: ldsfld int32 OutOptionalTests::'outArg@10-1' - IL_0005: ret - } - - .method assembly specialname static void 'set_outArg@10-1'(int32 'value') cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: stsfld int32 OutOptionalTests::'outArg@10-1' - IL_0006: ret - } - - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$OutOptionalTests::init@ - IL_0006: ldsfld int32 ''.$OutOptionalTests::init@ - IL_000b: pop - IL_000c: ret - } - - .method assembly specialname static void staticInitialization@() cil managed - { - - .maxstack 4 - .locals init (int32& V_0) - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 OutOptionalTests::outArg@9 - IL_0006: ldsflda int32 OutOptionalTests::outArg@9 - IL_000b: stloc.0 - IL_000c: ldloc.0 - IL_000d: ldc.i4.s 42 - IL_000f: stobj [runtime]System.Int32 - IL_0014: ldc.i4.0 - IL_0015: call int32 OutOptionalTests::get_outArg@9() - IL_001a: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_001f: stsfld class [runtime]System.Tuple`2 OutOptionalTests::patternInput@9 - IL_0024: ldc.i4.0 - IL_0025: stsfld int32 OutOptionalTests::'outArg@10-1' - IL_002a: ldsflda int32 OutOptionalTests::'outArg@10-1' - IL_002f: stloc.0 - IL_0030: ldloc.0 - IL_0031: ldc.i4.1 - IL_0032: stobj [runtime]System.Int32 - IL_0037: ldc.i4.0 - IL_0038: call int32 OutOptionalTests::'get_outArg@10-1'() - IL_003d: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_0042: stsfld class [runtime]System.Tuple`2 OutOptionalTests::'patternInput@10-1' - IL_0047: ret - } - - .property class [runtime]System.Tuple`2 - patternInput@9() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .get class [runtime]System.Tuple`2 OutOptionalTests::get_patternInput@9() - } - .property int32 outArg@9() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .set void OutOptionalTests::set_outArg@9(int32) - .get int32 OutOptionalTests::get_outArg@9() - } - .property class [runtime]System.Tuple`2 - 'patternInput@10-1'() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .get class [runtime]System.Tuple`2 OutOptionalTests::'get_patternInput@10-1'() - } - .property int32 'outArg@10-1'() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .set void OutOptionalTests::'set_outArg@10-1'(int32) - .get int32 OutOptionalTests::'get_outArg@10-1'() - } -} - -.class private abstract auto ansi sealed ''.$OutOptionalTests - extends [runtime]System.Object -{ - .field static assembly int32 init@ - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: call void OutOptionalTests::staticInitialization@() - IL_0005: ret - } - -} - """] - - [] - let ``Method with optional and out parameters resolves correctly (examples from original issue: https://github.com/dotnet/fsharp/issues/12515)`` () = - Fsx """ -open System.Runtime.InteropServices; - -// Define a member with both outref and default parameters. The compiler's implicit outref handling can handle this -// if required and optional parameters are provided, but not if the default parameters are left out - -type Thing = - static member Do(x: int, - fast: outref, - think: outref, - [] - token: System.Threading.CancellationToken - ) : bool = - true - static member Also(x: int, - [] - token: System.Threading.CancellationToken, - fast: outref, - think: outref - ) : bool = true - -// Works, was error because we can't strip the default `token` parameter for some reason -let ok, fast, think = Thing.Do(1) - -// works because the outrefs are detected and provided by the compiler -let ok2, fast2, think2 = Thing.Do(1, token = System.Threading.CancellationToken.None) - -// Works, was error because we can't strip the default `token` parameter for some reason -let ok3, fast3, think3 = Thing.Also(1) - -// works because the outrefs are detected and provided by the compiler -let ok4, fast4, think4 = Thing.Also(1, token = System.Threading.CancellationToken.None) - -// works but requires a lot of work for the user -let mutable fast5 = Unchecked.defaultof -let mutable think5 = Unchecked.defaultof - -let ok5 = Thing.Do(1, &fast5, &think5) - """ - - [] - let ``Method with same optional and out parameter does not resolve`` () = - Fsx """ -open System.Runtime.InteropServices - -type Thing = - static member Do([]i: outref) = true -let _, _ = Thing.Do() - """ - |> typecheck - |> shouldFail - |> withDiagnostics [ - (Error 501, Line 6, Col 12, Line 6, Col 22, "The member or object constructor 'Do' takes 1 argument(s) but is here given 0. The required signature is 'static member Thing.Do: [] i: outref -> bool'.") - ] - - [] - let ``optional and ParamArray parameter resolves correctly `` () = - Fsx """ -open System.Runtime.InteropServices - -type Thing = - static member Do( - [] something: string, - [] args: obj[]) = something, args - static member Do2( - [] something: string, - outvar: outref, - [] args: obj[]) = - - outvar <- 1 - something, args -let _, _ = Thing.Do() -let _, _ = Thing.Do("123") -let _, _ = Thing.Do("123", 1, 2, 3, 4) - -let _, _ = Thing.Do2() -let _, _ = Thing.Do2("123") -let _ = - let mutable x = 0 - Thing.Do2("123", &x) -let _ = - let mutable x = 0 - Thing.Do2("123", &x, 1, 2, 3, 4) - """ - |> typecheck - |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/BasicApplication/BasicApplication.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/BasicApplication/BasicApplication.fs index 21505f43355..0b6ac8b6347 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/BasicApplication/BasicApplication.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ApplicationExpressions/BasicApplication/BasicApplication.fs @@ -10,9 +10,10 @@ module BasicApplication = // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/ApplicationExpressions/BasicApplication) //Unexpected identifier in expression$ - [] + [] let ``E_PostfixType01_fs`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile @@ -23,9 +24,10 @@ module BasicApplication = // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/ApplicationExpressions/BasicApplication) //Unexpected identifier in member definition$ - [] + [] let ``E_PostfixType03_fs`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile @@ -37,9 +39,10 @@ module BasicApplication = // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/ApplicationExpressions/BasicApplication) // - [] + [] let ``PostfixType02_fs`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/BindingExpressions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/BindingExpressions.fs index cf2f4a833cc..f3f3d9d9d34 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/BindingExpressions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/BindingExpressions/BindingExpressions.fs @@ -22,9 +22,10 @@ module BindingExpressions = // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/ApplicationExpressions/BasicApplication) // SOURCE=AmbigLetBinding.fs # AmbigLetBinding - [] + [] let ``AmbigLetBinding_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -33,9 +34,10 @@ module BindingExpressions = // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/ApplicationExpressions/BasicApplication) // NoMT SOURCE=in01.fs SCFLAGS="--warnaserror+ --test:ErrorRanges" COMPILE_ONLY=1 # in01.fs - [] + [] let ``in01_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -44,9 +46,10 @@ module BindingExpressions = ] // NoMT SOURCE=in01.fsx FSIMODE=PIPE SCFLAGS="--warnaserror+ --test:ErrorRanges" COMPILE_ONLY=1 # in01.fsx - [] + [] let ``in01_fsx`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -54,9 +57,10 @@ module BindingExpressions = ] // NoMT SOURCE=in02.fs SCFLAGS="--warnaserror+ --test:ErrorRanges" COMPILE_ONLY=1 # in02.fs - [] + [] let ``in02_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -64,16 +68,18 @@ module BindingExpressions = ] // NoMT SOURCE=in02.fsx FSIMODE=PIPE SCFLAGS="--warnaserror+ --test:ErrorRanges" COMPILE_ONLY=1 # in02.fsx - [] + [] let ``in02_fsx`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldSucceed // NoMT SOURCE=in03.fs SCFLAGS="--warnaserror+ --test:ErrorRanges" COMPILE_ONLY=1 # in03.fs - [] + [] let ``in03_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -81,16 +87,18 @@ module BindingExpressions = ] // NoMT SOURCE=in03.fsx FSIMODE=PIPE SCFLAGS="--warnaserror+ --test:ErrorRanges" COMPILE_ONLY=1 # in03.fsx - [] + [] let ``in03_fsx`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldSucceed // NoMT SOURCE=in04.fs SCFLAGS="--warnaserror+ --test:ErrorRanges" COMPILE_ONLY=1 # in04.fs - [] + [] let ``in04_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -98,16 +106,18 @@ module BindingExpressions = ] // NoMT SOURCE=in04.fsx FSIMODE=PIPE SCFLAGS="--warnaserror+ --test:ErrorRanges" COMPILE_ONLY=1 # in04.fsx - [] + [] let ``in04_fsx`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldSucceed // NoMT SOURCE=in05.fs SCFLAGS="--warnaserror+ --test:ErrorRanges --flaterrors" COMPILE_ONLY=1 # in05.fs - [] + [] let ``in05_fs`` compilation = compilation + |> getCompilation |> verifyCompileAsExe |> shouldFail |> withDiagnostics [ @@ -116,9 +126,10 @@ module BindingExpressions = ] // NoMT SOURCE=in05.fsx FSIMODE=PIPE SCFLAGS="--warnaserror+ --test:ErrorRanges --flaterrors" COMPILE_ONLY=1 # in05.fsx - [] + [] let ``in05_fsx`` compilation = compilation + |> getCompilation |> withOptions ["--test:ErrorRanges"] |> compile |> shouldFail @@ -127,27 +138,30 @@ module BindingExpressions = ] // SOURCE=MutableLocals01.fs SCFLAGS="--warnon:3180 --optimize+ --test:ErrorRanges" - [] + [] let ``MutableLocals01_fs`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--nowarn:3370"; "--test:ErrorRanges"] |> compileAndRun |> shouldSucceed // SOURCE=W_TypeInferforGenericType.fs SCFLAGS="--test:ErrorRanges" # W_TypeInferforGenericType.fs - [] + [] let ``W_TypeInferforGenericType_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ (Warning 64, Line 10, Col 32, Line 10, Col 33, "This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type ''a'.") ] - [] + [] let ``UpperBindingPattern_fs`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -176,9 +190,10 @@ module BindingExpressions = (Warning 49, Line 122, Col 12, Line 122, Col 15, "Uppercase variable identifiers should not generally be used in patterns, and may indicate a missing open declaration or a misspelt pattern name.") ] - [] + [] let ``UpperBindingPattern_fs preview`` compilation = compilation + |> getCompilation |> asExe |> withLangVersionPreview |> withOptions ["--test:ErrorRanges"] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/PatternMatching.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/PatternMatching.fs index 9f8b10bc05b..2f88587276e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/PatternMatching.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/PatternMatching/PatternMatching.fs @@ -10,9 +10,10 @@ module PatternMatching = // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/ControlFlowExpressions/PatternMatching) - [] + [] let ``W_PatternMatchingCounterExample01_fs`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -23,9 +24,10 @@ module PatternMatching = // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/ControlFlowExpressions/PatternMatching) - [] + [] let ``W_PatternMatchingCounterExample02_fs`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -36,9 +38,10 @@ module PatternMatching = // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/ControlFlowExpressions/PatternMatching) - [] + [] let ``W_PatternMatchingCounterExample03_fs`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/SequenceIteration.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/SequenceIteration.fs index 478fcaebf2b..322ea5be52b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/SequenceIteration.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/SequenceIteration/SequenceIteration.fs @@ -10,9 +10,10 @@ module SequenceIteration = // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/ControlFlowExpressions/SequenceIteration) - [] + [] let ``W_IncompleteMatchFor01_fs`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/Type-relatedExpressions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/Type-relatedExpressions.fs index 40199c38d3a..b0e0d389b2f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/Type-relatedExpressions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Expressions/ControlFlowExpressions/Type-relatedExpressions/Type-relatedExpressions.fs @@ -9,9 +9,10 @@ open FSharp.Test.Compiler module TyperelatedExpressions = // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/Type-relatedExpressions) - [] + [] let ``E_rigidtypeannotation02_fs`` compilation = compilation + |> getCompilation |> asFsx |> typecheck |> shouldFail @@ -22,9 +23,10 @@ module TyperelatedExpressions = ] // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/Type-relatedExpressions) - [] + [] let ``E_rigidtypeannotation02b_fs`` compilation = compilation + |> getCompilation |> asFsx |> typecheck |> shouldFail @@ -34,17 +36,19 @@ module TyperelatedExpressions = ] // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/Type-relatedExpressions) - [] + [] let ``rigidtypeannotation01_fs`` compilation = compilation + |> getCompilation |> asFsx |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/Type-relatedExpressions) - [] + [] let ``staticcoercion01_fs`` compilation = compilation + |> getCompilation |> asFsx |> typecheck |> shouldFail @@ -56,9 +60,10 @@ module TyperelatedExpressions = ] // This test was automatically generated (moved from FSharpQA suite - Conformance/Expressions/Type-relatedExpressions) - [] + [] let ``staticcoercion01b_fs`` compilation = compilation + |> getCompilation |> asFsx |> typecheck |> shouldFail diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Diags/Attributes_Diags.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Diags/Attributes_Diags.fs index 47e9d048841..644d6bdd757 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Diags/Attributes_Diags.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Diags/Attributes_Diags.fs @@ -10,9 +10,10 @@ open FSharp.Test.Compiler module Attributes_Diags = // SOURCE=E_AdjustUses01a.fs SCFLAGS=--test:ErrorRanges # E_AdjustUses01a.fs - [] + [] let``E_AdjustUses01a_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -21,9 +22,10 @@ module Attributes_Diags = ] // SOURCE=E_AdjustUses01b.fs SCFLAGS=--test:ErrorRanges # E_AdjustUses01b.fs - [] + [] let``E_AdjustUses01b_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Attributes_Legacy.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Attributes_Legacy.fs index 9f45c66a2ca..8af1481ceda 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Attributes_Legacy.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/Legacy/Attributes_Legacy.fs @@ -10,9 +10,10 @@ open FSharp.Test.Compiler module AttributesLegacy = // SOURCE=Test01.fs SCFLAGS="--test:ErrorRanges" # Test01.fs - [] + [] let``Test01_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -23,9 +24,10 @@ module AttributesLegacy = ] // SOURCE=Test02.fs SCFLAGS="--test:ErrorRanges" # Test02.fs - [] + [] let``Test02_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -36,9 +38,10 @@ module AttributesLegacy = ] // SOURCE=Test03.fs SCFLAGS="--test:ErrorRanges" # Test03.fs - [] + [] let``Test03_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -48,9 +51,10 @@ module AttributesLegacy = ] // SOURCE=Test04.fs SCFLAGS="--test:ErrorRanges" # Test04.fs - [] + [] let``Test04_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -61,9 +65,10 @@ module AttributesLegacy = ] // SOURCE=Test05.fs SCFLAGS="--test:ErrorRanges" # Test05.fs - [] + [] let``Test05_fsx`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -74,9 +79,10 @@ module AttributesLegacy = ] // SOURCE=Test06.fs SCFLAGS="--test:ErrorRanges" # Test06.fs - [] + [] let``Test06_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -86,9 +92,10 @@ module AttributesLegacy = ] // SOURCE=Test07.fs SCFLAGS="--test:ErrorRanges" # Test07.fs - [] + [] let``Test07_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -98,9 +105,10 @@ module AttributesLegacy = ] // SOURCE=Test08.fs SCFLAGS="--test:ErrorRanges" # Test08.fs - [] + [] let``Test08_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -110,9 +118,10 @@ module AttributesLegacy = ] // SOURCE=Test09.fs SCFLAGS="--test:ErrorRanges" # Test09.fs - [] + [] let``Test09_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -121,9 +130,10 @@ module AttributesLegacy = ] // SOURCE=Test10.fs SCFLAGS="--test:ErrorRanges" # Test10.fs - [] + [] let``Test10_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -134,9 +144,10 @@ module AttributesLegacy = ] // SOURCE=Test11.fs SCFLAGS="--test:ErrorRanges" # Test11.fs - [] + [] let``Test11_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -147,9 +158,10 @@ module AttributesLegacy = ] // SOURCE=Test12.fs SCFLAGS="--test:ErrorRanges" # Test12.fs - [] + [] let``Test12_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -159,9 +171,10 @@ module AttributesLegacy = ] // SOURCE=Test13.fs SCFLAGS="--test:ErrorRanges" # Test13.fs - [] + [] let``Test13_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -172,9 +185,10 @@ module AttributesLegacy = ] // SOURCE=Test14.fs SCFLAGS="--test:ErrorRanges" # Test14.fs - [] + [] let``Test14_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -185,9 +199,10 @@ module AttributesLegacy = ] // SOURCE=Test15.fs SCFLAGS="--test:ErrorRanges" # Test15.fs - [] + [] let``Test15_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -197,9 +212,10 @@ module AttributesLegacy = ] // SOURCE=Test16.fs SCFLAGS="--test:ErrorRanges" # Test16.fs - [] + [] let``Test16_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -209,9 +225,10 @@ module AttributesLegacy = ] // SOURCE=Test17.fs SCFLAGS="--test:ErrorRanges" # Test17.fs - [] + [] let``Test17_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -221,9 +238,10 @@ module AttributesLegacy = ] // SOURCE=Test18.fs SCFLAGS="--test:ErrorRanges" # Test18.fs - [] + [] let``Test18_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -232,9 +250,10 @@ module AttributesLegacy = ] // SOURCE=Test19.fs SCFLAGS="--test:ErrorRanges" # Test19.fs - [] + [] let``Test19_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -244,9 +263,10 @@ module AttributesLegacy = ] // SOURCE=Test20.fs SCFLAGS="--test:ErrorRanges" # Test20.fs - [] + [] let``Test20_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -256,9 +276,10 @@ module AttributesLegacy = ] // SOURCE=Test21.fs SCFLAGS="--test:ErrorRanges" # Test21.fs - [] + [] let``Test21_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -267,9 +288,10 @@ module AttributesLegacy = ] // SOURCE=Test22.fs SCFLAGS="--test:ErrorRanges" # Test22.fs - [] + [] let``Test22_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -279,9 +301,10 @@ module AttributesLegacy = ] // SOURCE=Test23.fs SCFLAGS="--test:ErrorRanges" # Test23.fs - [] + [] let``Test23_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -291,9 +314,10 @@ module AttributesLegacy = ] // SOURCE=Test24.fs SCFLAGS="--test:ErrorRanges" # Test24.fs - [] + [] let``Test24_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -302,9 +326,10 @@ module AttributesLegacy = ] // SOURCE=Test25.fs SCFLAGS="--test:ErrorRanges" # Test25.fs - [] + [] let``Test25_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -313,9 +338,10 @@ module AttributesLegacy = ] // SOURCE=Test26.fs SCFLAGS="--test:ErrorRanges" # Test26.fs - [] + [] let``Test26_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -324,18 +350,20 @@ module AttributesLegacy = ] // SOURCE=Test27.fs SCFLAGS="--test:ErrorRanges" # Test27.fs - [] + [] let``Test27_fs`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--test:ErrorRanges"; "--warnaserror+"; "--nowarn:988"] |> compileExeAndRun |> shouldSucceed // SOURCE=Test28.fs SCFLAGS="--test:ErrorRanges" # Test28.fs - [] + [] let``Test28_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Attributes_New.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Attributes_New.fs index 8797695481d..c0941454ee2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Attributes_New.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Attributes/New/Attributes_New.fs @@ -10,9 +10,10 @@ open FSharp.Test.Compiler module AttributesNew = // SOURCE=Test01.fs SCFLAGS="--test:ErrorRanges" # Test01.fs - [] + [] let``Test01_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -21,9 +22,10 @@ module AttributesNew = ] // SOURCE=Test02.fs SCFLAGS="--test:ErrorRanges" # Test02.fs - [] + [] let``Test02_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -34,9 +36,10 @@ module AttributesNew = ] // SOURCE=Test03.fs SCFLAGS="--test:ErrorRanges" # Test03.fs - [] + [] let``Test03_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -45,9 +48,10 @@ module AttributesNew = ] // SOURCE=Test04.fs SCFLAGS="--test:ErrorRanges" # Test04.fs - [] + [] let``Test04_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -57,9 +61,10 @@ module AttributesNew = ] // SOURCE=Test05.fs SCFLAGS="--test:ErrorRanges" # Test05.fs - [] + [] let``Test05_fsx`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -70,9 +75,10 @@ module AttributesNew = ] // SOURCE=Test06.fs SCFLAGS="--test:ErrorRanges" # Test06.fs - [] + [] let``Test06_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -82,9 +88,10 @@ module AttributesNew = ] // SOURCE=Test07.fs SCFLAGS="--test:ErrorRanges" # Test07.fs - [] + [] let``Test07_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -93,9 +100,10 @@ module AttributesNew = ] // SOURCE=Test08.fs SCFLAGS="--test:ErrorRanges" # Test08.fs - [] + [] let``Test08_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -105,17 +113,19 @@ module AttributesNew = ] // SOURCE=Test09.fs SCFLAGS="--test:ErrorRanges" # Test09.fs - [] + [] let``Test09_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=Test10.fs SCFLAGS="--test:ErrorRanges" # Test10.fs - [] + [] let``Test10_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -124,9 +134,10 @@ module AttributesNew = ] // SOURCE=Test11.fs SCFLAGS="--test:ErrorRanges" # Test11.fs - [] + [] let``Test11_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -137,9 +148,10 @@ module AttributesNew = ] // SOURCE=Test12.fs SCFLAGS="--test:ErrorRanges" # Test12.fs - [] + [] let``Test12_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -148,9 +160,10 @@ module AttributesNew = ] // SOURCE=Test13.fs SCFLAGS="--test:ErrorRanges" # Test13.fs - [] + [] let``Test13_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -159,9 +172,10 @@ module AttributesNew = ] // SOURCE=Test14.fs SCFLAGS="--test:ErrorRanges" # Test14.fs - [] + [] let``Test14_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -172,9 +186,10 @@ module AttributesNew = ] // SOURCE=Test15.fs SCFLAGS="--test:ErrorRanges" # Test15.fs - [] + [] let``Test15_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -183,9 +198,10 @@ module AttributesNew = ] // SOURCE=Test16.fs SCFLAGS="--test:ErrorRanges" # Test16.fs - [] + [] let``Test16_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -194,9 +210,10 @@ module AttributesNew = ] // SOURCE=Test17.fs SCFLAGS="--test:ErrorRanges" # Test17.fs - [] + [] let``Test17_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -208,25 +225,28 @@ module AttributesNew = ] // SOURCE=Test18.fs SCFLAGS="--test:ErrorRanges" # Test18.fs - [] + [] let``Test18_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=Test19.fs SCFLAGS="--test:ErrorRanges" # Test19.fs - [] + [] let``Test19_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=Test20.fs SCFLAGS="--test:ErrorRanges" # Test20.fs - [] + [] let``Test20_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -237,9 +257,10 @@ module AttributesNew = ] // SOURCE=Test21.fs SCFLAGS="--test:ErrorRanges" # Test21.fs - [] + [] let``Test21_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -248,9 +269,10 @@ module AttributesNew = ] // SOURCE=Test22.fs SCFLAGS="--test:ErrorRanges" # Test22.fs - [] + [] let``Test22_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -259,9 +281,10 @@ module AttributesNew = ] // SOURCE=Test23.fs SCFLAGS="--test:ErrorRanges" # Test23.fs - [] + [] let``Test23_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -272,9 +295,10 @@ module AttributesNew = ] // SOURCE=Test24.fs SCFLAGS="--test:ErrorRanges" # Test24.fs - [] + [] let``Test24_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -283,9 +307,10 @@ module AttributesNew = ] // SOURCE=Test25.fs SCFLAGS="--test:ErrorRanges" # Test25.fs - [] + [] let``Test25_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -294,9 +319,10 @@ module AttributesNew = ] // SOURCE=Test26.fs SCFLAGS="--test:ErrorRanges" # Test26.fs - [] + [] let``Test26_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -307,18 +333,20 @@ module AttributesNew = ] // SOURCE=Test27.fs SCFLAGS="--test:ErrorRanges" # Test27.fs - [] + [] let``Test27_fs`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--test:ErrorRanges"; "--warnaserror+"; "--nowarn:988"] |> compileExeAndRun |> shouldSucceed // SOURCE=Test28.fs SCFLAGS="--test:ErrorRanges" # Test28.fs - [] + [] let``Test28_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Basic.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Basic.fs index c3a239e07f0..03d9d4035ce 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Basic.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Basic.fs @@ -10,25 +10,28 @@ open FSharp.Test.Compiler module Basic = // SOURCE=Arrays.fsx # Arrays.fsx - [] + [] let``Arrays_fsx`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=Comparison01.fs # Comparison01.fs - [] + [] let``Comparison01_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=CustomEquality01.fs # CustomEquality01.fs - [] + [] let``CustomEquality01_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -36,9 +39,10 @@ module Basic = (Warning 988, Line 37, Col 1, Line 37, Col 1, "Main module of program is empty: nothing will happen when it is run") ] - [] + [] let``E_CustomEqualityEquals01_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -52,9 +56,10 @@ module Basic = ] // SOURCE=E_CustomEqualityGetHashCode01.fs SCFLAGS="--test:ErrorRanges" # E_CustomEqualityGetHashCode01.fs - [] + [] let``E_CustomEqualityGetHashCode01_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -71,9 +76,10 @@ module Basic = ] // SOURCE=E_ExceptionsNoComparison.fs SCFLAGS="--test:ErrorRanges" # E_ExceptionsNoComparison.fs - [] + [] let``E_ExceptionsNoComparison_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -84,122 +90,137 @@ module Basic = // SOURCE=EqualOnTuples01.fs # EqualOnTuples01.fs - [] + [] let``EqualOnTuples01_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=Equality01.fs # Equality01.fs - [] + [] let``Equality01_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=Exceptions.fsx # Exceptions.fsx - [] + [] let``Exceptions_fsx`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=Generated_Record.fsx # Generated_Record.fsx - [] + [] let``Generated_Record_fsx`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=Hashing01.fs # Hashing01.fs - [] + [] let``Hashing01_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=Lists.fsx # Lists.fsx - [] + [] let``Lists_fsx`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=NeverGenerated_Class.fsx # NeverGenerated_Class.fsx - [] + [] let``NeverGenerated_Class_fsx`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=NeverGenerated_Delegate.fsx # NeverGenerated_Delegate.fsx - [] + [] let``NeverGenerated_Delegate_fsx`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=NeverGenerated_Enum.fsx # NeverGenerated_Enum.fsx - [] + [] let``NeverGenerated_Enum_fsx`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=NeverGenerated_Interface.fsx # NeverGenerated_Interface.fsx - [] + [] let``NeverGenerated_Interface_fsx`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=Options.fsx # Options.fsx - [] + [] let``Options_fsx`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=Sample_Records.fsx # Sample_Records.fsx - [] + [] let``Sample_Records_fsx`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=Sample_Tuples.fsx # Sample_Tuples.fsx - [] + [] let``Sample_Tuples_fsx`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=Structs.fsx # Structs.fsx - [] + [] let``Structs_fsx`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=Unions.fsx # Unions.fsx - [] + [] let``Unions_fsx`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/IComparison.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/IComparison.fs index f35a1720fe3..7ceb03c3881 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/IComparison.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/IComparison/IComparison.fs @@ -9,36 +9,40 @@ open FSharp.Test.Compiler module IComparison = // SOURCE=DU.fs # DU.fs - [] + [] let``DU_fs`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--nowarn:342"] |> compileAndRun |> shouldSucceed // SOURCE=Record.fs # Record.fs - [] + [] let``Record_fs`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--nowarn:342"] |> compileAndRun |> shouldSucceed // SOURCE=Struct.fs # Struct.fs - [] + [] let``Struct_fs`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--nowarn:342"] |> compileAndRun |> shouldSucceed // SOURCE=W_ImplIComparable.fs # W_ImplIComparable.fs - [] + [] let``W_ImplIComparable_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefSafetyAnalysis.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefSafetyAnalysis.fs index 073111d8504..533369961e0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefSafetyAnalysis.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/ByrefSafetyAnalysis.fs @@ -30,14 +30,17 @@ module ByrefSafetyAnalysis = |> compileAndRun // SOURCE=Migrated02.fs SCFLAGS="--test:ErrorRanges" # Migrated02.fs - [] + [] let``MigratedTest02_fs`` compilation = - compilation |> verifyCompileAndRun |> shouldSucceed - + compilation + |> getCompilation + |> verifyCompileAndRun |> shouldSucceed + // SOURCE=E_Migrated02.fs SCFLAGS="--test:ErrorRanges" # E_Migrated02.fs - [] + [] let``E_Migrated02_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -108,26 +111,28 @@ module ByrefSafetyAnalysis = ] // SOURCE=Migrated03.fs SCFLAGS="--test:ErrorRanges" # Migrated03.fs - [] + [] let``MigratedTest03_fs`` compilation = let csharpLib = CSharpFromPath (__SOURCE_DIRECTORY__ ++ "MigratedTest03CSharpLib.cs") |> withName "CSharpLib3" compilation + |> getCompilation |> withReferences [ csharpLib ] |> withOptions ["--nowarn:3370"] |> compileExeAndRun |> shouldSucceed // SOURCE=E_Migrated03.fs SCFLAGS="--test:ErrorRanges" # E_Migrated03.fs - [] + [] let``E_Migrated03_fs`` compilation = let csharpLib = CSharpFromPath (__SOURCE_DIRECTORY__ ++ "MigratedTest03CSharpLib.cs") |> withName "CSharpLib3" compilation + |> getCompilation |> asExe |> withReferences [ csharpLib ] |> withNoWarn 52 @@ -149,94 +154,155 @@ The type 'ByRefKinds.InOut' does not match the type 'ByRefKinds.In'") (Error 3239, Line 46, Col 17, Line 46, Col 25, "Cannot partially apply the extension method 'Test2' because the first parameter is a byref type.") ] - [] + [] let``TryGetValue_fs`` compilation = - compilation |> withPrelude |> compileExeAndRun |> shouldSucceed + compilation + |> getCompilation + |> withPrelude |> compileExeAndRun |> shouldSucceed - [] + [] let``CompareExchange_fs`` compilation = compilation + |> getCompilation |> withPrelude |> withOptions ["--nowarn:3370"] |> compileExeAndRun |> shouldSucceed - [] + [] let``ByRefParam_fs`` compilation = - compilation |> verifyCompileAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> verifyCompileAndRun |> shouldSucceed + + [] let``ByRefParam_ExplicitOutAttribute_fs`` compilation = - compilation |> withPrelude |> withOptions ["--nowarn:3370"] |> compileExeAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> withPrelude + |> withOptions ["--nowarn:3370"] |> compileExeAndRun |> shouldSucceed + + [] let``ByRefParam_ExplicitInAttribute_fs`` compilation = - compilation |> verifyCompileAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> verifyCompileAndRun |> shouldSucceed + + [] let``ByRefReturn_fs`` compilation = - compilation |> verifyCompileAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> verifyCompileAndRun + |> shouldSucceed + + [] let``Slot_ByRefReturn_fs`` compilation = - compilation |> verifyCompileAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> verifyCompileAndRun + |> shouldSucceed + + [] let``InRefReturn_fs`` compilation = - compilation |> verifyCompileAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> verifyCompileAndRun + |> shouldSucceed + + [] let``Slot_InRefReturn_fs`` compilation = - compilation |> verifyCompileAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> verifyCompileAndRun + |> shouldSucceed + + [] let``OutRefParam_fs`` compilation = - compilation |> verifyCompileAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> verifyCompileAndRun + |> shouldSucceed + + [] let``OutRefParam_ExplicitOutAttribute_fs`` compilation = - compilation |> verifyCompileAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> verifyCompileAndRun + |> shouldSucceed + + [] let``Slot_OutRefParam_fs`` compilation = - compilation |> verifyCompileAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> verifyCompileAndRun + |> shouldSucceed + + [] let``ByRefParam_OverloadedTest_ExplicitOutAttribute_fs`` compilation = - compilation |> verifyCompileAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> verifyCompileAndRun + |> shouldSucceed + + [] let``OutRefParam_Overloaded_ExplicitOutAttribute_fs`` compilation = - compilation |> verifyCompileAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> verifyCompileAndRun + |> shouldSucceed + + [] let``OutRefParam_Overloaded_fs`` compilation = - compilation |> verifyCompileAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> verifyCompileAndRun + |> shouldSucceed + + [] let``InRefParam_ExplicitInAttribute_fs`` compilation = - compilation |> verifyCompileAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> verifyCompileAndRun + |> shouldSucceed + + [] let``InRefParam_ExplicitInAttributeDateTime_fs`` compilation = - compilation |> verifyCompileAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> verifyCompileAndRun + |> shouldSucceed + + [] let``InRefParam`` compilation = - compilation |> verifyCompileAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> verifyCompileAndRun + |> shouldSucceed + + [] let``InRefParamOverload_ExplicitAddressOfAtCallSite`` compilation = - compilation |> withNoWarn 52 |> verifyCompileAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> withNoWarn 52 + |> verifyCompileAndRun + |> shouldSucceed + + [] let``InRefParamOverload_ImplicitAddressOfAtCallSite`` compilation = - compilation |> withNoWarn 52 |> verifyCompileAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> withNoWarn 52 + |> verifyCompileAndRun + |> shouldSucceed + + [] let``InRefParamOverload_ImplicitAddressOfAtCallSite2`` compilation = - compilation |> withNoWarn 52 |> verifyCompileAndRun |> shouldSucceed - + compilation + |> getCompilation + |> withNoWarn 52 + |> verifyCompileAndRun + |> shouldSucceed + // TODO: Delete this, move into feature branch, or finish this. See: https://github.com/dotnet/fsharp/pull/7989#discussion_r369841104 #if IMPLICIT_ADDRESS_OF module FeatureImplicitAddressOf = @@ -262,14 +328,20 @@ The type 'ByRefKinds.InOut' does not match the type 'ByRefKinds.In'") compilation |> verifyCompileAndRun |> shouldSucceed #endif - [] + [] let``InRefParam_Generic_ExplicitAddressOfAttCallSite1`` compilation = - compilation |> verifyCompileAndRun |> shouldSucceed - - [] + compilation + |> getCompilation + |> verifyCompileAndRun + |> shouldSucceed + + [] let``InRefParam_Generic_ExplicitAddressOfAttCallSite2`` compilation = - compilation |> verifyCompileAndRun |> shouldSucceed - + compilation + |> getCompilation + |> verifyCompileAndRun + |> shouldSucceed + module ByrefReturn = [] let``TestImmediateReturn`` compilation = @@ -492,13 +564,18 @@ The type 'ByRefKinds.InOut' does not match the type 'ByRefKinds.In'") let``TestStructRecord`` compilation = compilation |> withNoWarn 988 |> withNoWarn 3560 |> verifyCompileAndRun |> shouldSucceed - [] + [] let``NoTailcallToByrefsWithModReq`` compilation = - compilation |> withNoWarn 20 |> verifyCompileAndRun |> shouldSucceed + compilation + |> getCompilation + |> withNoWarn 20 + |> verifyCompileAndRun + |> shouldSucceed - [] + [] let``E_CantTakeAddressOfExpressionReturningReferenceType`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -722,9 +799,10 @@ type outref<'T> with // SOURCE=E_ByrefAsArrayElement.fs SCFLAGS="--test:ErrorRanges" # E_ByrefAsArrayElement.fs - [] + [] let``E_ByrefAsArrayElement_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -736,9 +814,10 @@ type outref<'T> with ] // SOURCE=E_ByrefAsGenericArgument01.fs SCFLAGS="--test:ErrorRanges" # E_ByrefAsGenericArgument01.fs - [] + [] let``E_ByrefAsGenericArgument01_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -749,18 +828,20 @@ type outref<'T> with ] // NoMT SOURCE=ByrefInFSI1.fsx FSIMODE=PIPE COMPILE_ONLY=1 # ByrefInFSI1.fsx - [] + [] let``ByrefInFSI1_fsx`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--warnaserror+"; "--nowarn:988"] |> compileExeAndRun |> shouldSucceed // SOURCE=E_ByrefUsedInInnerLambda01.fs SCFLAGS="--test:ErrorRanges" # E_ByrefUsedInInnerLambda01.fs - [] + [] let``E_ByrefUsedInInnerLambda01_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -769,9 +850,10 @@ type outref<'T> with ] // SOURCE=E_ByrefUsedInInnerLambda02.fs SCFLAGS="--test:ErrorRanges" # E_ByrefUsedInInnerLambda02.fs - [] + [] let``E_ByrefUsedInInnerLambda02_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -780,9 +862,10 @@ type outref<'T> with ] // SOURCE=E_ByrefUsedInInnerLambda03.fs SCFLAGS="--test:ErrorRanges" # E_ByrefUsedInInnerLambda03.fs - [] + [] let``E_ByrefUsedInInnerLambda03_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -791,9 +874,10 @@ type outref<'T> with ] // SOURCE=E_SetFieldToByref01.fs SCFLAGS="--test:ErrorRanges" # E_SetFieldToByref01.fs - [] + [] let``E_SetFieldToByref01_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -804,9 +888,10 @@ type outref<'T> with ] // SOURCE=E_SetFieldToByref02.fs SCFLAGS="--test:ErrorRanges" # E_SetFieldToByref02.fs - [] + [] let``E_SetFieldToByref02_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -814,9 +899,10 @@ type outref<'T> with (Error 431, Line 8, Col 9, Line 8, Col 17, "A byref typed value would be stored here. Top-level let-bound byref values are not permitted.") ] // SOURCE=E_SetFieldToByref03.fs SCFLAGS="--test:ErrorRanges" # E_SetFieldToByref03.fs - [] + [] let``E_SetFieldToByref03_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -827,9 +913,10 @@ type outref<'T> with ] // SOURCE=E_SetFieldToByref04.fs SCFLAGS="--test:ErrorRanges" # E_SetFieldToByref04.fs - [] + [] let``E_SetFieldToByref04_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -840,9 +927,10 @@ type outref<'T> with ] // SOURCE=E_SetFieldToByref05.fs SCFLAGS="--test:ErrorRanges" # E_SetFieldToByref05.fs - [] + [] let``E_SetFieldToByref05_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -854,9 +942,10 @@ type outref<'T> with ] // SOURCE=E_FirstClassFuncTakesByref.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_FirstClassFuncTakesByref.fs - [] + [] let``E_FirstClassFuncTakesByref_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -865,9 +954,10 @@ type outref<'T> with ] // SOURCE=E_StaticallyResolvedByRef01.fs SCFLAGS="--test:ErrorRanges" # E_StaticallyResolvedByRef01.fs - [] + [] let``E_StaticallyResolvedByRef01_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -880,9 +970,10 @@ type outref<'T> with ] // SOURCE=UseByrefInLambda01.fs # UseByrefInLambda01.fs - [] + [] let``UseByrefInLambda01_fs`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--warnaserror+"; "--nowarn:988"] |> compileExeAndRun @@ -890,17 +981,19 @@ type outref<'T> with #if NET7_0_OR_GREATER // This constructor added in .NET 7: https://learn.microsoft.com/en-us/dotnet/api/system.span-1.-ctor?view=net-7.0#system-span-1-ctor(-0@) - [] + [] let``ReturnFieldSetBySpan_fs`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--warnaserror+"; "--nowarn:988"] |> compileExeAndRun |> shouldSucceed - [] + [] let``ReturnSpan01_fs`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--warnaserror+"; "--nowarn:988"] |> compileExeAndRun @@ -908,9 +1001,10 @@ type outref<'T> with #endif #if NETSTANDARD2_1_OR_GREATER - [] + [] let``E_TopLevelByref_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -918,9 +1012,10 @@ type outref<'T> with (Error 431, Line 6, Col 5, Line 6, Col 13, "A byref typed value would be stored here. Top-level let-bound byref values are not permitted.") ] - [] + [] let``E_SpanUsedInInnerLambda01_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -928,9 +1023,10 @@ type outref<'T> with (Error 406, Line 8, Col 34, Line 8, Col 45, "The byref-typed variable 'span' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions.") ] - [] + [] let``E_SpanUsedInInnerLambda02_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveSafetyAnalysis.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveSafetyAnalysis.fs index 52bf8601869..ecc99ef26e7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveSafetyAnalysis.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveSafetyAnalysis.fs @@ -15,9 +15,10 @@ module RecursiveSafetyAnalysis = |> compileExeAndRun // SOURCE=E_CyclicReference01.fs SCFLAGS="--mlcompatibility --test:ErrorRanges --flaterrors" # E_CyclicReference01.fs - [] + [] let ``E_CyclicReference01_fs`` compilation = compilation + |> getCompilation |> withOptions ["--mlcompatibility"; "--flaterrors"] |> withLangVersion50 |> asExe @@ -29,9 +30,10 @@ module RecursiveSafetyAnalysis = ] // SOURCE=E_DuplicateRecursiveRecords.fs SCFLAGS="--test:ErrorRanges" # E_DuplicateRecursiveRecords.fs - [] + [] let``E_DuplicateRecursiveRecords_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -39,9 +41,10 @@ module RecursiveSafetyAnalysis = (Error 37, Line 10, Col 5, Line 10, Col 8, "Duplicate definition of type, exception or module 'Foo'") ] - [] + [] let ``E_RecursiveInline_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -53,9 +56,10 @@ module RecursiveSafetyAnalysis = ] // SOURCE=E_TypeDeclaration01.fs SCFLAGS="--langversion:5.0 --test:ErrorRanges" COMPILE_ONLY=1 # E_TypeDeclaration01.fs - [] + [] let ``E_TypeDeclaration01`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -64,9 +68,10 @@ module RecursiveSafetyAnalysis = ] //Type constraint mismatch - [] + [] let ``E_TypeDeclaration02_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -78,9 +83,10 @@ module RecursiveSafetyAnalysis = ] // SOURCE=E_VariationsOnRecursiveStruct.fs SCFLAGS="--test:ErrorRanges" # E_VariationsOnRecursiveStruct.fs - [] + [] let ``E_VariationsOnRecursiveStruct_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail @@ -89,35 +95,39 @@ module RecursiveSafetyAnalysis = (Error 912, Line 6, Col 6, Line 6, Col 8, "This declaration element is not permitted in an augmentation") ] - [] + [] let ``InfiniteRecursiveExplicitConstructor_fs`` compilation = compilation + |> getCompilation |> asFsx |> compile |> shouldSucceed // SOURCE=RecursiveTypeDeclarations01.fs # RecursiveTypeDeclarations01.fs - [] + [] let ``RecursiveTypeDeclarations01_fs`` compilation = compilation + |> getCompilation |> asExe |> ignoreWarnings |> compile |> shouldSucceed // SOURCE=RecursiveValueDeclarations01.fs # RecursiveValueDeclarations01.fs - [] + [] let ``RecursiveValueDeclarations01_fs`` compilation = compilation + |> getCompilation |> asExe |> ignoreWarnings |> compile |> shouldSucceed // SOURCE=RecursiveTypeDeclarations02.fs # RecursiveTypeDeclarations02.fs - [] + [] let ``RecursiveTypeDeclarations02_fs`` compilation = compilation + |> getCompilation |> withOptions ["--nowarn:3370"] |> verifyCompileAndRun |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/HashLight/HashLight.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/HashLight/HashLight.fs index 8602b1e5633..a52b3d380c2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/HashLight/HashLight.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/HashLight/HashLight.fs @@ -9,9 +9,10 @@ open FSharp.Test.Compiler module HashLight = // This test was automatically generated (moved from FSharpQA suite - Conformance/LexicalFiltering/HashLight) - [] + [] let ``IndentationWithComputationExpression01_fs`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--warnaserror+"] |> typecheck diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/HighPrecedenceApplication/HighPrecedenceApplication.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/HighPrecedenceApplication/HighPrecedenceApplication.fs index 5665bbcd675..4ec5b1b53d1 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/HighPrecedenceApplication/HighPrecedenceApplication.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/HighPrecedenceApplication/HighPrecedenceApplication.fs @@ -10,9 +10,10 @@ module HighPrecedenceApplication = // This test was automatically generated (moved from FSharpQA suite - Conformance/LexicalFiltering/HighPrecedenceApplication) // - [] + [] let ``RangeOperator01_fs`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["-a"] |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/OffsideExceptions.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/OffsideExceptions.fs index dee88a3c5fa..2be0b9897db 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/OffsideExceptions.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalFiltering/OffsideExceptions/OffsideExceptions.fs @@ -9,23 +9,22 @@ open FSharp.Test.Compiler.Assertions.StructuredResultsAsserts module OffsideExceptions = - type FileAttribute(file) = - inherit DirectoryAttribute(__SOURCE_DIRECTORY__, Includes=[|file|]) - // This test was automatically generated (moved from FSharpQA suite - Conformance/LexicalFiltering/Basic/OffsideExceptions) // - [] + [] let InfixTokenPlusOne compilation = compilation + |> getCompilation |> asFsx |> typecheck |> shouldSucceed |> shouldSucceed |> ignore - [] + [] let RelaxWhitespace2 compilation = compilation + |> getCompilation |> asFsx |> withLangVersion60 |> withOptions ["--nowarn:25"] // Incomplete pattern matches on this expression. @@ -33,9 +32,10 @@ module OffsideExceptions = |> shouldSucceed |> ignore - [] + [] let RelaxWhitespace2_Warning25 compilation = compilation + |> getCompilation |> asFsx |> withLangVersion60 |> verifyBaseline @@ -488,9 +488,10 @@ raise (new Exception("exit 1")) Message = "Unexpected end of input in type definition" } ] |> ignore - [] + [] let RelaxWhitespace2_Fs50 compilation = compilation + |> getCompilation |> asFsx |> withLangVersion50 |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/And.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/And.fs index 7f46ad02250..b92c1e57c29 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/And.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/And.fs @@ -8,43 +8,48 @@ open FSharp.Test.Compiler module And = // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/And) - [] + [] let ``And - andPattern01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/And) - [] + [] let ``And - andPattern02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/And) - [] + [] let ``And - andPattern03_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - [] + [] let ``And - andPattern04_fs`` compilation = compilation + |> getCompilation |> asFs |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/And) - [] + [] let ``And - E_IdentBoundTwice_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/Array.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/Array.fs index 5d686020f22..190b12d316d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/Array.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/Array.fs @@ -8,36 +8,40 @@ open FSharp.Test.Compiler module Array = // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Array) - [] + [] let ``Array - arrayMatch01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Array) - [] + [] let ``Array - arrayMatch02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Array) - [] + [] let ``Array - arrayMatch03_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Array) - [] + [] let ``Array - TrailingSemi01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/As.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/As.fs index 81867fed44a..b4074b0b2cf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/As.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/As.fs @@ -8,18 +8,20 @@ open FSharp.Test.Compiler module As = // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/As) - [] + [] let ``Simple - asPattern01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/As) - [] + [] let ``Simple - asPattern02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/ConsList.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/ConsList.fs index d0f92838187..6292d3b78fa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/ConsList.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/ConsList.fs @@ -8,18 +8,20 @@ open FSharp.Test.Compiler module ConsList = // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/ConsList) - [] + [] let ``ConsList - consPattern01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/ConsList) - [] + [] let ``ConsList - E_consOnNonList_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -36,9 +38,10 @@ but here has type ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/ConsList) - [] + [] let ``ConsList - E_consPattern01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -49,9 +52,10 @@ but here has type ''a list' ") // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/ConsList) - [] + [] let ``ConsList - OutsideMatch01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/Decimal.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/Decimal.fs index 1f168db110f..9f51d0f9747 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/Decimal.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/Decimal.fs @@ -8,9 +8,10 @@ open FSharp.Test.Compiler module Decimal = - [] + [] let ``Decimal - literal01.fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges";] |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/DynamicTypeTest.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/DynamicTypeTest.fs index 358471ba5e5..79fa9270343 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/DynamicTypeTest.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/DynamicTypeTest.fs @@ -8,27 +8,30 @@ open FSharp.Test.Compiler module DynamicTypeTest = // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/DynamicTypeTest) - [] + [] let ``DynamicTypeTest - consPattern01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/DynamicTypeTest) - [] + [] let ``DynamicTypeTest - dynamicTypeTest01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/DynamicTypeTest) - [] + [] let ``DynamicTypeTest - dynamicTypeTest02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -37,49 +40,54 @@ module DynamicTypeTest = (Warning 26, Line 31, Col 7, Line 31, Col 17, "This rule will never be matched") (Warning 26, Line 32, Col 7, Line 32, Col 16, "This rule will never be matched") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/DynamicTypeTest) - [] + [] let ``DynamicTypeTest - dynamicTypeTest03_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/DynamicTypeTest) - [] + [] let ``DynamicTypeTest - dynamicTypeTest04_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 64, Line 8, Col 7, Line 8, Col 11, "This construct causes code to be less generic than indicated by its type annotations. The type variable implied by the use of a '#', '_' or other type annotation at or near 'dynamicTypeTest04.fs(8,9)-(8,10)' has been constrained to be type 'exn'.") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/DynamicTypeTest) - [] + [] let ``DynamicTypeTest - dynTestSealedType01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/DynamicTypeTest) - [] + [] let ``DynamicTypeTest - E_DynamicTestPrimType01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail |> withSingleDiagnostic (Error 16, Line 11, Col 7, Line 11, Col 15, "The type 'int' does not have any proper subtypes and cannot be used as the source of a type test or runtime coercion.") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/DynamicTypeTest) - [] + [] let ``DynamicTypeTest - E_DynamTyTestVarType01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -89,47 +97,52 @@ module DynamicTypeTest = to obj involves an indeterminate type based on information prior to this program point. Runtime type tests are not allowed on some types. Further type annotations are needed.") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/DynamicTypeTest) - [] + [] let ``DynamicTypeTest - genericType01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/DynamicTypeTest) - [] + [] let ``DynamicTypeTest - Regression01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/DynamicTypeTest) - [] + [] let ``DynamicTypeTest - Regression02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/DynamicTypeTest) - [] + [] let ``DynamicTypeTest - TwoAtOnce01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/DynamicTypeTest) - [] + [] let ``DynamicTypeTest - W_RedundantPattern01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -138,20 +151,22 @@ involves an indeterminate type based on information prior to this program point. (Warning 26, Line 12, Col 7, Line 12, Col 16, "This rule will never be matched") (Warning 26, Line 18, Col 7, Line 18, Col 16, "This rule will never be matched") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/DynamicTypeTest) - [] + [] let ``DynamicTypeTest - W_TypeTestWillAlwaysHold01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 67, Line 13, Col 7, Line 13, Col 13, "This type test or downcast will always hold")// This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/DynamicTypeTest) - - [] + + [] let ``DynamicTypeTest - E_DynamicTest01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -159,10 +174,11 @@ involves an indeterminate type based on information prior to this program point. |> withDiagnostics [ (Warning 26, Line 3, Col 3, Line 3, Col 54, "This rule will never be matched") ] - - [] + + [] let ``DynamicTypeTest - E_DynamicTest02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -170,10 +186,11 @@ involves an indeterminate type based on information prior to this program point. |> withDiagnostics [ (Warning 26, Line 4, Col 7, Line 4, Col 11, "This rule will never be matched") ] - - [] + + [] let ``DynamicTypeTest - E_DynamicTest03_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/Expression.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/Expression.fs index 2c82340ad76..fc9ed2de733 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/Expression.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/Expression.fs @@ -8,37 +8,41 @@ open FSharp.Test.Compiler module Expression = // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Expression) - [] + [] let ``Expression - E_CounterExample01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 25, Line 7, Col 11, Line 7, Col 12, "Incomplete pattern matches on this expression. For example, the value '0' may indicate a case not covered by the pattern(s).") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Expression) - [] + [] let ``Expression - NoCounterExampleTryWith01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Expression) - [] + [] let ``Expression - patterns01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Expression) - [] + [] let ``Expression - patterns02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -48,11 +52,12 @@ module Expression = (Warning 25, Line 7, Col 24, Line 7, Col 25, "Incomplete pattern matches on this expression. For example, the value '0' may indicate a case not covered by the pattern(s).") (Warning 25, Line 8, Col 35, Line 8, Col 36, "Incomplete pattern matches on this expression.") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Expression) - [] + [] let ``Expression - W_CounterExampleWithEnum01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -65,11 +70,12 @@ module Expression = (Warning 25, Line 30, Col 10, Line 30, Col 18, "Incomplete pattern matches on this expression. For example, the value '[_;_;_]' may indicate a case not covered by the pattern(s).") (Warning 25, Line 34, Col 10, Line 34, Col 18, "Incomplete pattern matches on this expression. For example, the value '[|_; 1|]' may indicate a case not covered by the pattern(s).") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Expression) - [] + [] let ``Expression - W_CounterExampleWithEnum02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -82,11 +88,12 @@ module Expression = (Warning 25, Line 27, Col 10, Line 27, Col 18, "Incomplete pattern matches on this expression. For example, the value 'T.Y' may indicate a case not covered by the pattern(s).") (Warning 25, Line 30, Col 10, Line 30, Col 18, "Incomplete pattern matches on this expression. For example, the value 'T.Y' may indicate a case not covered by the pattern(s).") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Expression) - [] + [] let ``Expression - W_whenGuards01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -94,38 +101,42 @@ module Expression = |> withDiagnostics [ (Warning 25, Line 11, Col 9, Line 11, Col 10, "Incomplete pattern matches on this expression. For example, the value '1' may indicate a case not covered by the pattern(s). However, a pattern rule with a 'when' clause might successfully match this value.") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Expression) - [] + [] let ``Expression - whenGuards01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Expression) - [] + [] let ``Expression - whenGuards02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Expression) - [] + [] let ``Expression - whenGuardss01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Expression) - [] + [] let ``Expression - whenGuardss02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/Named.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/Named.fs index 8f7d5a12362..c1bfa90f03d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/Named.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/Named.fs @@ -8,96 +8,107 @@ open FSharp.Test.Compiler module Named = // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - ActivePatternOutsideMatch01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - ActivePatternOutsideMatch02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - activePatterns01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - activePatterns02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - activePatterns03_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - activePatterns05_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - activePatterns06_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - activePatterns07_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - activePatterns08_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - [] + [] let ``Named - activePatterns09_fs`` compilation = compilation + |> getCompilation |> asFs |> typecheck |> shouldSucceed - - [] + + [] let ``Named - activePatterns10_fs`` compilation = compilation + |> getCompilation |> asFs |> typecheck |> shouldFail @@ -113,66 +124,73 @@ module Named = ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - ActivePatternUnconstrained01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> ignoreWarnings |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - AsHighOrderFunc01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - discUnion01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - _DiscUnion01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_ActivePatternHasNoFields_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail |> withSingleDiagnostic (Error 3174, Line 10, Col 24, Line 10, Col 25, "Active patterns do not have fields. This syntax is invalid.") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_ActivePatternNotAFunction_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail |> withSingleDiagnostic (Error 1209, Line 5, Col 6, Line 5, Col 11, "Active pattern '|A|B|' is not a function") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_ActivePatterns01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -187,11 +205,12 @@ module Named = (Error 624, Line 17, Col 9, Line 17, Col 17, "The '|' character is not permitted in active pattern case identifiers") (Error 623, Line 18, Col 7, Line 18, Col 9, "Active pattern case identifiers must begin with an uppercase letter") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_ActivePatterns02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -201,9 +220,10 @@ module Named = (Warning 20, Line 6, Col 1, Line 6, Col 38, "The result of this expression has type 'int' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.") ] - [] + [] let ``Named - E_ActivePatterns03_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -270,11 +290,12 @@ but here has type (Error 39, Line 34, Col 8, Line 34, Col 18, "The pattern discriminator 'FooB++' is not defined.") (Warning 25, Line 34, Col 7, Line 34, Col 22, "Incomplete pattern matches on this expression.") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_ActivePatternUnconstrained01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -286,9 +307,10 @@ but here has type ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_Error_LetRec01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -297,11 +319,12 @@ but here has type 'Choice<'a,'b>' but here has type 'string' ") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_Error_LetRec02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -313,12 +336,12 @@ but here has type but here has type 'string' ") ] - - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_Error_LetRec03_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -332,9 +355,10 @@ but here has type ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_Error_LetRec04_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -343,11 +367,12 @@ but here has type ''a option' but here has type 'string' ") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_Error_NonParam01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -356,11 +381,12 @@ but here has type 'Choice<'a,'b>' but here has type 'string' ") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_Error_NonParam02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -374,9 +400,10 @@ but here has type ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_Error_NonParam03_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -388,11 +415,12 @@ but here has type but here has type 'string' ") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_Error_NonParam04_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -401,11 +429,12 @@ but here has type ''a option' but here has type 'string' ") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_Error_Param01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -414,11 +443,12 @@ but here has type 'Choice<'a,'b>' but here has type 'string' ") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_Error_Param02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -430,11 +460,12 @@ but here has type but here has type 'string' ") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_Error_Param03_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -446,11 +477,12 @@ but here has type but here has type 'string' ") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_Error_Param04_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -461,11 +493,12 @@ but here has type but here has type 'string' ") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_LargeActivePat01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -474,11 +507,12 @@ but here has type (Error 265, Line 6, Col 6, Line 6, Col 47, "Active patterns cannot return more than 7 possibilities") (Error 265, Line 8, Col 6, Line 8, Col 23, "Active patterns cannot return more than 7 possibilities") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_MulticasePartialNotAllowed01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -488,21 +522,23 @@ but here has type (Error 3868, Line 22, Col 7, Line 22, Col 17, "This active pattern expects exactly one pattern argument, e.g., 'WhiteSpace pat'."); (Error 1107, Line 20, Col 7, Line 20, Col 21, "Partial active patterns may only generate one result") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_ParameterRestrictions01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail |> withSingleDiagnostic (Error 722, Line 15, Col 23, Line 15, Col 34, "Only active patterns returning exactly one result may accept arguments") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - E_PatternMatchRegressions02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -512,57 +548,63 @@ but here has type (Warning 25, Line 30, Col 11, Line 30, Col 12, "Incomplete pattern matches on this expression.") (Error 1210, Line 22, Col 6, Line 22, Col 38, "Active pattern '|ClientExternalTypeUse|WillFail|' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice = A x'") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - MultiActivePatterns01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - NamedLiteral01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - NamedLiteral02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - ParameterizedPartialActivePattern01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - PatternMatchRegressions01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldFail |> withSingleDiagnostic (Warning 25, Line 22, Col 11, Line 22, Col 12, "Incomplete pattern matches on this expression.") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - PatternMatchRegressions02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -570,11 +612,12 @@ but here has type |> withDiagnostics [ (Warning 25, Line 20, Col 11, Line 20, Col 12, "Incomplete pattern matches on this expression.") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) - [] + [] let ``Named - RecursiveActivePats_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/Null.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/Null.fs index 3faeae07f26..46fac3505cc 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/Null.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/Null.fs @@ -8,9 +8,10 @@ open FSharp.Test.Compiler module Null = // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Null) - [] + [] let ``Null - E_notNullCompatible01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -18,9 +19,10 @@ module Null = |> withSingleDiagnostic (Error 43, Line 14, Col 7, Line 14, Col 11, "The type 'Foo' does not have 'null' as a proper value") // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Null) - [] + [] let ``Null - matchNull01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/Record.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/Record.fs index a75f8910e5e..807025b3879 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/Record.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/Record.fs @@ -8,9 +8,10 @@ open FSharp.Test.Compiler module Record = // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Record) - [] + [] let ``Record - E_RecordFieldNotDefined01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -19,11 +20,12 @@ module Record = (Error 39, Line 9, Col 13, Line 9, Col 14, "The record label 'X' is not defined.") (Error 39, Line 9, Col 20, Line 9, Col 21, "The record label 'Y' is not defined.") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Record) - [] + [] let ``Record - E_RecTypesNotMatch01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -32,11 +34,12 @@ module Record = (Error 1129, Line 11, Col 13, Line 11, Col 14, "The record type 'R1' does not contain a label 'A'.") (Error 1129, Line 11, Col 20, Line 11, Col 21, "The record type 'R1' does not contain a label 'B'.") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Record) - [] + [] let ``Record - E_SyntaxError01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -44,38 +47,42 @@ module Record = |> withDiagnostics [ (Error 10, Line 9, Col 14, Line 9, Col 15, "Unexpected symbol '}' in pattern. Expected '.', '=' or other token.") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Record) - [] + [] let ``Record - recordPatterns01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Record) - [] + [] let ``Record - recordPatterns02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Record) - [] + [] let ``Record - structRecordPatterns01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Record) - [] + [] let ``Record - structRecordPatterns02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/Simple.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/Simple.fs index e161faded77..8b556d25cfa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/Simple.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/Simple.fs @@ -9,10 +9,10 @@ open FSharp.Test.Compiler module Simple = // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - - [] + [] let ``Simple - W_Incomplete01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -20,10 +20,10 @@ module Simple = |> withSingleDiagnostic (Warning 25, Line 92, Col 13, Line 92, Col 14, "Incomplete pattern matches on this expression. For example, the value 'Result (_)' may indicate a case not covered by the pattern(s).") // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - - [] + [] let ``Simple - W_Incomplete02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile @@ -36,10 +36,10 @@ module Simple = ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - - [] + [] let ``Simple - W_BindCapitalIdent_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile @@ -49,9 +49,10 @@ module Simple = (Warning 49, Line 10, Col 16, Line 10, Col 19, "Uppercase variable identifiers should not generally be used in patterns, and may indicate a missing open declaration or a misspelt pattern name.") ] - [] + [] let ``Simple - W_BindCapitalIdent_fs preview - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> withLangVersionPreview |> asFsx |> withOptions ["--test:ErrorRanges"] @@ -63,48 +64,53 @@ module Simple = ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - CodeGenReg01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - E_constPattern01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldFail |> withSingleDiagnostic (Warning 104, Line 9, Col 11, Line 9, Col 14, "Enums may take values outside known cases. For example, the value 'enum (7)' may indicate a case not covered by the pattern(s).") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - E_namedLiberal01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldFail |> withSingleDiagnostic (Warning 104, Line 10, Col 11, Line 10, Col 14, "Enums may take values outside known cases. For example, the value 'enum (7)' may indicate a case not covered by the pattern(s).") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - E_SyntaxError01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldFail |> withSingleDiagnostic (Error 10, Line 8, Col 14, Line 8, Col 15, "Unexpected symbol'[' in pattern matching. Expected '->' or other token.") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - E_ValueCapture01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile @@ -117,11 +123,12 @@ module Simple = int8 int") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - MatchFailureExn01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile @@ -130,101 +137,112 @@ module Simple = (Warning 25, Line 20, Col 28, Line 20, Col 29, "Incomplete pattern matches on this expression. For example, the value '0' may indicate a case not covered by the pattern(s).") (Warning 25, Line 24, Col 15, Line 24, Col 23, "Incomplete pattern matches on this expression.") ] - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - simplePatterns01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - simplePatterns02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - simplePatterns03_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - simplePatterns04_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - simplePatterns05_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - simplePatterns06_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - simplePatterns07_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - simplePatterns08_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - simplePatterns09_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - simplePatterns10_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - simplePatterns11_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile @@ -232,100 +250,111 @@ module Simple = |> withSingleDiagnostic (Warning 26, Line 10, Col 7, Line 10, Col 8, "This rule will never be matched") // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - simplePatterns12_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - simplePatterns13_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - simplePatterns14_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - simplePatterns15_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - simplePatterns16_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges";] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - [] + [] let ``Simple - simplePatterns17_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges";] |> compile |> shouldFail |> withSingleDiagnostic (Warning 25, Line 16, Col 13, Line 16, Col 17, "Incomplete pattern matches on this expression. For example, the value '``some-non-null-value``' may indicate a case not covered by the pattern(s).") - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/AsPatterns) - [] + [] let ``Simple - simplePatterns18_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges";] |> compile |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/AsPatterns) - [] + [] let ``Simple - simplePatterns19_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges";] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/AsPatterns) - [] + [] let ``Simple - simplePatterns20_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges";] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/AsPatterns) - [] + [] let ``Simple - ValueCapture01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges";] |> compile |> shouldSucceed - + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/AsPatterns) - [] + [] let ``Simple - ValueCapture02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges";] |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/SimpleConstant.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/SimpleConstant.fs index b2e120d025c..c9dca126573 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/SimpleConstant.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/SimpleConstant.fs @@ -8,18 +8,20 @@ open FSharp.Test.Compiler module SimpleConstant = // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - DiffAssembly_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - E_NoRangeConst01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -27,9 +29,10 @@ module SimpleConstant = |> withSingleDiagnostic (Error 10, Line 9, Col 9, Line 9, Col 11, "Unexpected symbol '..' in pattern matching. Expected '->' or other token.") // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - E_type_bigint_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -40,9 +43,10 @@ module SimpleConstant = ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - E_type_bignum40_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -54,54 +58,60 @@ module SimpleConstant = ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - FullyQualify01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - matchConst01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - matchConst02_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - matchConst03_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - matchConst04_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - MatchLiteral01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -116,9 +126,10 @@ module SimpleConstant = ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - MatchNaN_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -130,18 +141,20 @@ module SimpleConstant = ] // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - type_bigint_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - type_bool_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck @@ -149,72 +162,80 @@ module SimpleConstant = |> withSingleDiagnostic (Warning 26, Line 10, Col 7, Line 10, Col 8, "This rule will never be matched") // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - type_byte_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - type_byteArr_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - type_char_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - type_double_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - type_float32_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - type_int_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - type_int16_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) - [] + [] let ``SimpleConstant - type_int64_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Wildcard/Wildcard.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Wildcard/Wildcard.fs index 2831e485b84..5bc1083de3b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Wildcard/Wildcard.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Wildcard/Wildcard.fs @@ -8,9 +8,10 @@ open FSharp.Test.Compiler module Wildcard = // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Wildcard) - [] + [] let ``Wildcard - wildCardPatterns01_fs - --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFs |> withOptions ["--test:ErrorRanges"] |> typecheck diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PseudoCustomAttributes/PseudoCustomAttributes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PseudoCustomAttributes/PseudoCustomAttributes.fs index f372668b108..356667c4b5c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PseudoCustomAttributes/PseudoCustomAttributes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PseudoCustomAttributes/PseudoCustomAttributes.fs @@ -10,62 +10,66 @@ module ``PseudoCustomAttributes Test Cases`` = let ``PseudoCustomAttributes - Compile and Run`` compilation = compilation + |> getCompilation |> asExe |> compileAndRun |> shouldSucceed let ``PseudoCustomAttributes - Fail to compile`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldFail - [] + [] let ``PseudoCustomAttributes - AssemblyCompany_001_fs`` compilation = ``PseudoCustomAttributes - Compile and Run`` compilation - [] + [] let ``PseudoCustomAttributes - AssemblyConfiguration_001_fs`` compilation = ``PseudoCustomAttributes - Compile and Run`` compilation - [] + [] let ``PseudoCustomAttributes - AssemblyCopyright_001_fs`` compilation = ``PseudoCustomAttributes - Compile and Run`` compilation - [] + [] let ``PseudoCustomAttributes - AssemblyDescription_001_fs`` compilation = ``PseudoCustomAttributes - Compile and Run`` compilation - [] + [] let ``PseudoCustomAttributes - AssemblyFileVersion_001_fs`` compilation = ``PseudoCustomAttributes - Compile and Run`` compilation - [] + [] let ``PseudoCustomAttributes - AssemblyInformationalVersion_001_fs`` compilation = ``PseudoCustomAttributes - Compile and Run`` compilation - [] + [] let ``PseudoCustomAttributes - AssemblyTitle_001_fs`` compilation = ``PseudoCustomAttributes - Compile and Run`` compilation - [] + [] let ``PseudoCustomAttributes - AssemblyTrademark_001_fs`` compilation = ``PseudoCustomAttributes - Compile and Run`` compilation - [] + [] let ``PseudoCustomAttributes - AssemblyVersion_001_fs`` compilation = ``PseudoCustomAttributes - Compile and Run`` compilation - [] + [] let ``PseudoCustomAttributes - AssemblyVersion_002_fs`` compilation = compilation + |> getCompilation |> asExe |> compileExeAndRun |> shouldSucceed - [] + [] let ``PseudoCustomAttributes - AssemblyVersion_003_fs`` compilation = compilation + |> getCompilation |> asExe |> withAssemblyVersion "4.5.6.7" |> ignoreWarnings diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordTypes.fs index 856c34bbfa6..bebf3652605 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/RecordTypes/RecordTypes.fs @@ -29,43 +29,49 @@ module RecordTypes = //# Fails due to stack overflow. //#ReqNOCov SOURCE=BigRecord01.fs # BigRecord01.fs - [] + [] let ``BigRecord01_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds //# Renaming the .exe because for some weird reason on some OSes having 'DispatchSlot' in the .exe //# seems to trigger the UAC dialog... (e.g. Win7 x86) // SOURCE=DispatchSlot_Equals01.fsx SCFLAGS="-o dl_equals01.exe" # DispatchSlot_Equals01.fsx - [] + [] let ``DispatchSlot_Equals01_fsx`` compilation = compilation + |> getCompilation |> withName "dl_equals01" |> verifyCompileAndRunSucceeds // SOURCE=DispatchSlot_GetHashCode.fsx SCFLAGS="-o dl_gethashcode01.exe" # DispatchSlot_GetHashCode.fsx - [] + [] let ``DispatchSlot_GetHashCode_fsx`` compilation = compilation + |> getCompilation |> withName "dl_gethashcode01" |> verifyCompileAndRunSucceeds // SOURCE=DuckTypingRecords01.fs # DuckTypingRecords01.fs - [] + [] let ``DuckTypingRecords01_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=EqualAndBoxing01.fs # EqualAndBoxing01.fs - [] + [] let ``EqualAndBoxing01_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=E_InheritRecord01.fs SCFLAGS="--test:ErrorRanges" # E_InheritRecord01.fs - [] + [] let ``E_InheritRecord01_fs`` compilation = compilation + |> getCompilation |> verifyTypeCheck |> shouldFail |> withDiagnostics [ @@ -73,9 +79,10 @@ module RecordTypes = ] // SOURCE=E_Interface_IComparable.fsx SCFLAGS="--test:ErrorRanges" # E_Interface_IComparable.fsx - [] + [] let ``E_Interface_IComparable_fsx`` compilation = compilation + |> getCompilation |> verifyTypeCheck |> shouldFail |> withDiagnostics [ @@ -85,9 +92,10 @@ module RecordTypes = // SOURCE=E_Interface_IStructuralHash.fsx # E_Interface_IStructuralHash.fsx - [] + [] let ``E_Interface_IStructuralHash_fsx`` compilation = compilation + |> getCompilation |> verifyTypeCheck |> shouldFail |> withDiagnostics [ @@ -98,9 +106,10 @@ module RecordTypes = ] // SOURCE=E_MutableFields01.fsx SCFLAGS="--test:ErrorRanges" # E_MutableFields01.fsx - [] + [] let ``E_MutableFields01_fsx`` compilation = compilation + |> getCompilation |> verifyTypeCheck |> shouldFail |> withDiagnostics [ @@ -113,9 +122,10 @@ module RecordTypes = ] // SOURCE=E_RecordCloning01.fs # E_RecordCloning01.fs - [] + [] let ``E_RecordCloning01_fs`` compilation = compilation + |> getCompilation |> verifyTypeCheck |> shouldFail |> withDiagnostics [ @@ -123,9 +133,10 @@ module RecordTypes = ] // SOURCE=E_RecordsNotNull01.fs # E_RecordsNotNull01.fs - [] + [] let ``E_RecordsNotNull01_fs`` compilation = compilation + |> getCompilation |> verifyTypeCheck |> shouldFail |> withDiagnostics [ @@ -133,15 +144,17 @@ module RecordTypes = ] // SOURCE=E_RecordsNotNull02.fs # E_RecordsNotNull02.fs - [] + [] let ``E_RecordsNotNull02_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=E_Scoping01.fsx SCFLAGS="--test:ErrorRanges" # E_Scoping01.fsx - [] + [] let ``E_Scoping01_fsx`` compilation = compilation + |> getCompilation |> verifyTypeCheck |> shouldFail |> withDiagnostics [ @@ -149,9 +162,10 @@ module RecordTypes = ] // SOURCE=E_Scoping02.fsx SCFLAGS=" --test:ErrorRanges --flaterrors" # E_Scoping02.fsx - [] + [] let ``E_Scoping02_fsx`` compilation = compilation + |> getCompilation |> verifyTypeCheck |> shouldFail |> withDiagnostics [ @@ -159,9 +173,10 @@ module RecordTypes = ] // SOURCE=E_TypeInference01.fs SCFLAGS="--test:ErrorRanges" # E_TypeInference01.fs - [] + [] let ``E_TypeInference01_fs`` compilation = compilation + |> getCompilation |> verifyTypeCheck |> shouldFail |> withDiagnostics [ @@ -169,9 +184,10 @@ module RecordTypes = ] // SOURCE=E_TypeInference01b.fs SCFLAGS="--test:ErrorRanges" # E_TypeInference01b.fs - [] + [] let ``E_TypeInference01b_fs`` compilation = compilation + |> getCompilation |> verifyTypeCheck |> shouldFail |> withDiagnostics [ @@ -179,9 +195,10 @@ module RecordTypes = ] // SOURCE=E_TypeInference02.fs SCFLAGS="--test:ErrorRanges" # E_TypeInference02.fs - [] + [] let ``E_TypeInference02_fs`` compilation = compilation + |> getCompilation |> verifyTypeCheck |> shouldFail |> withDiagnostics [ @@ -189,9 +206,10 @@ module RecordTypes = ] // SOURCE=E_UnitType01.fsx SCFLAGS="-a --test:ErrorRanges" # E_UnitType01.fsx - [] + [] let ``E_UnitType01_fsx`` compilation = compilation + |> getCompilation |> verifyTypeCheck |> shouldFail |> withDiagnostics [ @@ -199,184 +217,214 @@ module RecordTypes = ] // SOURCE=FieldBindingAfterWith01a.fs SCFLAGS=-a # FieldBindingAfterWith01a.fs - [] + [] let ``FieldBindingAfterWith01a_fs`` compilation = compilation + |> getCompilation |> verifyTypeCheckAsFsxAsLibrary // SOURCE=FieldBindingAfterWith01b.fs SCFLAGS=-a # FieldBindingAfterWith01b.fs - [] + [] let ``FieldBindingAfterWith01b_fs`` compilation = compilation + |> getCompilation |> verifyTypeCheckAsFsxAsLibrary // SOURCE=FullyQualify01.fs # FullyQualify01.fs - [] + [] let ``FullyQualify01_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=Interface01.fsx # Interface01.fsx - [] + [] let ``Interface01_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=Interface_Empty.fsx # Interface_Empty.fsx - [] + [] let ``Interface_Empty_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=Interface_IComparable.fsx # Interface_IComparable.fsx - [] + [] let ``Interface_IComparable_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=ImplicitEquals01.fs # ImplicitEquals001.fs - [] + [] let ``ImplicitEquals01_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=LongIdentifiers01.fsx # LongIdentifiers01.fsx - [] + [] let ``LongIdentifiers01_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=Member01.fsx # Member01.fsx - [] + [] let ``Member01_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=MutableFields01.fsx # MutableFields01.fsx - [] + [] let ``MutableFields01_fsx`` compilation = compilation + |> getCompilation |> withOptions ["--nowarn:464"] |> verifyCompileAndRunSucceeds // SOURCE=MutableFields_SampleFromSpec02.fsx # MutableFields_SampleFromSpec02.fsx - [] + [] let ``MutableFields_SampleFromSpec02_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=NoClashMemberIFaceMember.fs SCFLAGS="--warnaserror+" # NoClashMemberIFaceMember.fs - [] + [] let ``NoClashMemberIFaceMember_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // NoMT SOURCE=Overload_Equals.fs COMPILE_ONLY=1 SCFLAGS=--warnaserror+ FSIMODE=PIPE # Overload_Equals.fs - fsi - [] + [] let ``Overload_Equals_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // NoMT SOURCE=Overload_GetHashCode.fs COMPILE_ONLY=1 SCFLAGS=--warnaserror+ FSIMODE=PIPE # Overload_GetHashCode.fs - fsi - [] + [] let ``Overload_GetHashCode_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // NoMT SOURCE=Overload_ToString.fs COMPILE_ONLY=1 SCFLAGS=--warnaserror+ FSIMODE=PIPE # Overload_ToString.fs - fsi - [] + [] let ``Overload_ToString_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=SampleFromSpec01.fsx # SampleFromSpec01.fsx - [] + [] let ``SampleFromSpec01_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=SampleFromSpec03.fsx # SampleFromSpec03.fsx - [] + [] let ``SampleFromSpec03_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=Scoping03.fsx # Scoping03.fsx - [] + [] let ``Scoping03_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=Scoping04.fsx # Scoping04.fsx - [] + [] let ``Scoping04_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=RecordCloning01.fs # RecordCloning01.fs - [] + [] let ``RecordCloning01_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=RecordCloning02.fs # RecordCloning02.fs - [] + [] let ``RecordCloning02_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=RecordCloning03.fs # RecordCloning03.fs - [] + [] let ``RecordCloning03_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=StructRecordCloning01.fs # StructRecordCloning01.fs - [] + [] let ``StructRecordCloning01_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=StructRecordCloning02.fs # StructRecordCloning02.fs - [] + [] let ``StructRecordCloning02_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=StructRecordCloning03.fs # StructRecordCloning03.fs - [] + [] let ``StructRecordCloning03_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=Syntax01.fs # Syntax01.fs - [] + [] let ``Syntax01_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=TypeInference01.fs # TypeInference01.fs - [] + [] let ``TypeInference01_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=TypeInference02.fs # TypeInference02.fs - [] + [] let ``TypeInference02_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // This test was automatically generated (moved from FSharpQA suite - Conformance/BasicTypeAndModuleDefinitions/RecordTypes) - [] + [] let ``UnitType01_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRunSucceeds // SOURCE=W_Overrides01.fsx SCFLAGS="--test:ErrorRanges" # W_Overrides01.fsx - [] + [] let ``W_Overrides01_fsx`` compilation = compilation + |> getCompilation |> verifyTypeCheck |> shouldFail |> withDiagnostics [ diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/StructTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/StructTypes.fs index 95e1cb2e4a6..8e2939c22fe 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/StructTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/StructTypes/StructTypes.fs @@ -9,9 +9,10 @@ open FSharp.Test.Compiler module StructTypes = // This test was automatically generated (moved from FSharpQA suite - Conformance/StructTypes) - [] + [] let ``StructTypes - Overload_Equals_fs`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--warnaserror+"; "--nowarn:988"] |> typecheck @@ -19,9 +20,10 @@ module StructTypes = |> ignore // This test was automatically generated (moved from FSharpQA suite - Conformance/StructTypes) - [] + [] let ``StructTypes - Overload_GetHashCode_fs`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--warnaserror+"; "--nowarn:988"] |> typecheck @@ -29,18 +31,20 @@ module StructTypes = |> ignore // This test was automatically generated (moved from FSharpQA suite - Conformance/StructTypes) - [] + [] let ``StructTypes - Overload_ToString_f`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--warnaserror+"; "--nowarn:988"] |> typecheck |> shouldSucceed |> ignore - [] + [] let ``StructTypes - E_Inheritance.fs`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--warnaserror+"; "--nowarn:988"] |> typecheck diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/CheckingSyntacticTypes/CheckingSyntacticTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/CheckingSyntacticTypes/CheckingSyntacticTypes.fs index 60d9132f5e4..9523a5301cd 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/CheckingSyntacticTypes/CheckingSyntacticTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/CheckingSyntacticTypes/CheckingSyntacticTypes.fs @@ -10,9 +10,10 @@ module CheckingSyntacticTypes = // This test was automatically generated (moved from FSharpQA suite - Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes) //This member, function or value declaration may not be declared 'inline' - [] + [] let ``E_CannotInlineVirtualMethods1_fs`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile @@ -23,9 +24,10 @@ module CheckingSyntacticTypes = // This test was automatically generated (moved from FSharpQA suite - Conformance/TypesAndTypeConstraints/CheckingSyntacticTypes) //This member, function or value declaration may not be declared 'inline' - [] + [] let ``E_CannotInlineVirtualMethod2_fs`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs index 942219ba172..5623ac08ca7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs @@ -1228,10 +1228,11 @@ printf "%A" res""" [] #else // SOURCE=ConstrainedAndInterfaceCalls.fs # ConstrainedAndInterfaceCalls.fs - [] + [] #endif let ``ConstrainedAndInterfaceCalls.fs`` compilation = - compilation + compilation + |> getCompilation |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] |> verifyCompile |> shouldFail diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/LogicalPropertiesOfTypes/LogicalPropertiesOfTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/LogicalPropertiesOfTypes/LogicalPropertiesOfTypes.fs index e12f72cd76b..356f418d19c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/LogicalPropertiesOfTypes/LogicalPropertiesOfTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/LogicalPropertiesOfTypes/LogicalPropertiesOfTypes.fs @@ -9,9 +9,10 @@ open FSharp.Test.Compiler module LogicalPropertiesOfTypes = // This test was automatically generated (moved from FSharpQA suite - Conformance/TypesAndTypeConstraints/LogicalPropertiesOfTypes) - [] + [] let ``TypeWithNullLiteral_NetRef_fsx`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["-a"] |> typecheck diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs index 0c61d444a9d..02b10b52b28 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs @@ -21,42 +21,47 @@ module UnionTypes = |> compileAndRun //SOURCE=BeginWithUppercase01.fsx SCFLAGS= # BeginWithUppercase01.fsx - [] + [] let ``BeginWithUppercase01_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //# Renaming the .exe because for some weird reason on some OSes having 'DispatchSlot' in the .exe //# seems to trigger the UAC dialog... (e.g. Win7 x86) //SOURCE=DispatchSlot_Equals01.fsx SCFLAGS="-o dl_equals01.exe" # DispatchSlot_Equals01.fsx - [] + [] let ``DispatchSlot_Equals01_fsx`` compilation = compilation + |> getCompilation |> withName "dl_equals01" |> verifyCompileAndRun |> shouldSucceed //SOURCE=DispatchSlot_GetHashCode.fsx SCFLAGS="-o dl_gethashcode01.exe" # DispatchSlot_GetHashCode.fsx - [] + [] let ``DispatchSlot_GetHashCode_fsx`` compilation = compilation + |> getCompilation |> withName "dl_gethashcode01" |> verifyCompileAndRun |> shouldSucceed //SOURCE=EqualAndBoxing01.fs # EqualAndBoxing01.fs - [] + [] let ``EqualAndBoxing01_fs`` compilation = compilation + |> getCompilation |> asFsx |> verifyCompileAndRun |> shouldSucceed //SOURCE=E_BeginWithUppercase01.fsx SCFLAGS="--test:ErrorRanges" # E_BeginWithUppercase01.fsx - [] + [] let ``E_BeginWithUppercase01_fsx`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -65,9 +70,10 @@ module UnionTypes = ] //SOURCE=E_BeginWithUppercase02.fsx SCFLAGS="--test:ErrorRanges" # E_BeginWithUppercase02.fsx - [] + [] let ``E_BeginWithUppercase02_fsx`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -75,9 +81,10 @@ module UnionTypes = ] //SOURCE=E_BeginWithUppercase03.fsx SCFLAGS="--test:ErrorRanges" # E_BeginWithUppercase03.fsx - [] + [] let ``E_BeginWithUppercase03_fsx`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -85,9 +92,10 @@ module UnionTypes = ] //SOURCE=E_BeginWithUppercase04.fsx SCFLAGS="--test:ErrorRanges" # E_BeginWithUppercase04.fsx - [] + [] let ``E_BeginWithUppercase04_fsx`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -95,9 +103,10 @@ module UnionTypes = ] //SOURCE=E_BeginWithUppercaseNoPipe01.fsx SCFLAGS="--test:ErrorRanges" # E_BeginWithUppercaseNoPipe01.fsx - [] + [] let ``E_BeginWithUppercaseNoPipe01_fsx`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -107,9 +116,10 @@ module UnionTypes = ] //SOURCE=E_GenericFunctionValuedStaticProp01.fs SCFLAGS="--test:ErrorRanges --warnaserror-" # E_GenericFunctionValuedStaticProp01.fs - [] + [] let ``E_GenericFunctionValuedStaticProp01_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -118,9 +128,10 @@ module UnionTypes = ] //SOURCE=E_Interface_IComparable.fsx SCFLAGS="--test:ErrorRanges" # E_Interface_IComparable.fsx - [] + [] let ``E_Interface_IComparable_fsx`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -129,9 +140,10 @@ module UnionTypes = ] //SOURCE=E_Member_Duplicate01.fsx SCFLAGS="--test:ErrorRanges" # E_Member_Duplicate01.fsx - [] + [] let ``E_Member_Duplicate01_fsx`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -141,9 +153,10 @@ module UnionTypes = ] //SOURCE=E_ScopeAndDataConstrAndPattern01.fsx SCFLAGS="--test:ErrorRanges" # E_ScopeAndDataConstrAndPattern01.fsx - [] + [] let ``E_ScopeAndDataConstrAndPattern01_fsx`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -151,9 +164,10 @@ module UnionTypes = ] //SOURCE=E_Interface_IStructuralHash.fsx # E_Interface_IStructuralHash.fsx - [] + [] let ``E_Interface_IStructuralHash_fsx`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -164,9 +178,10 @@ module UnionTypes = ] //SOURCE=E_FieldNameUsedMulti.fs SCFLAGS="--test:ErrorRanges" # E_FieldNameUsedMulti.fs - [] + [] let ``E_FieldNameUsedMulti_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -176,9 +191,10 @@ module UnionTypes = ] //SOURCE=E_FieldMemberClash.fs SCFLAGS="--test:ErrorRanges" # E_FieldMemberClash.fs - [] + [] let ``E_FieldMemberClash_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -189,9 +205,10 @@ module UnionTypes = ] //SOURCE=E_InheritUnion.fs # E_InheritUnion.fs - [] + [] let ``E_InheritUnion_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -200,9 +217,10 @@ module UnionTypes = ] //SOURCE=E_LowercaseDT.fs # E_LowercaseDT.fs - [] + [] let ``E_LowercaseDT_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -210,9 +228,10 @@ module UnionTypes = ] //SOURCE=E_Overload_Equals.fs SCFLAGS="--test:ErrorRanges" # E_Overload_Equals.fs - [] + [] let ``E_Overload_Equals_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -221,9 +240,10 @@ module UnionTypes = ] //SOURCE=E_Overload_GetHashCode.fs SCFLAGS="--test:ErrorRanges" # E_Overload_GetHashCode.fs - [] + [] let ``E_Overload_GetHashCode_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -232,9 +252,10 @@ module UnionTypes = ] //SOURCE=E_SampleFromSpec01d.fsx SCFLAGS="--test:ErrorRanges" # E_SampleFromSpec01d.fsx - [] + [] let ``E_SampleFromSpec01d_fsx`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -242,9 +263,10 @@ module UnionTypes = ] //SOURCE=E_SampleFromSpec01d2.fsx SCFLAGS="--test:ErrorRanges" # E_SampleFromSpec01d2.fsx - [] + [] let ``E_SampleFromSpec01d2_fsx`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -252,9 +274,10 @@ module UnionTypes = ] //SOURCE=E_UnionConstructorBadFieldName.fs SCFLAGS="--test:ErrorRanges" # E_UnionConstructorBadFieldName.fs - [] + [] let ``E_UnionConstructorBadFieldName_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -266,9 +289,10 @@ module UnionTypes = ] //SOURCE=E_UnionFieldConflictingName.fs SCFLAGS="--test:ErrorRanges" # E_UnionFieldConflictingName.fs - [] + [] let ``E_UnionFieldConflictingName_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -278,9 +302,10 @@ module UnionTypes = ] //SOURCE=E_UnionFieldNamedTag.fs SCFLAGS="--test:ErrorRanges" # E_UnionFieldNamedTag.fs - [] + [] let ``E_UnionFieldNamedTag_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -288,9 +313,10 @@ module UnionTypes = ] //SOURCE=E_UnionFieldNamedTagNoDefault.fs SCFLAGS="--test:ErrorRanges" # E_UnionFieldNamedTagNoDefault.fs - [] + [] let ``E_UnionFieldNamedTagNoDefault_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -298,9 +324,10 @@ module UnionTypes = ] //SOURCE=E_UnionMemberNamedTag.fs SCFLAGS="--test:ErrorRanges" # E_UnionMemberNamedTag.fs - [] + [] let ``E_UnionMemberNamedTag_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -308,9 +335,10 @@ module UnionTypes = ] //SOURCE=E_UnionMemberNamedTagNoDefault.fs SCFLAGS="--test:ErrorRanges" # E_UnionMemberNamedTagNoDefault.fs - [] + [] let ``E_UnionMemberNamedTagNoDefault_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -318,9 +346,10 @@ module UnionTypes = ] //SOURCE=E_UnionMemberNamedTags.fs SCFLAGS="--test:ErrorRanges" # E_UnionMemberNamedTags.fs - [] + [] let ``E_UnionMemberNamedTags_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -328,9 +357,10 @@ module UnionTypes = ] //SOURCE=E_UnionMemberNamedTagsNoDefault.fs SCFLAGS="--test:ErrorRanges" # E_UnionMemberNamedTagsNoDefault.fs - [] + [] let ``E_UnionMemberNamedTagsNoDefault_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -338,9 +368,10 @@ module UnionTypes = ] //SOURCE=E_UnionsNotNull01.fs # E_UnionsNotNull01.fs - [] + [] let ``E_UnionsNotNull01_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -348,191 +379,217 @@ module UnionTypes = ] //SOURCE=ImplicitEquals001.fs # ImplicitEquals001.fs - [] + [] let ``ImplicitEquals001_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //SOURCE=Interface01.fsx SCFLAGS= # Interface01.fsx - [] + [] let ``Interface01_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //SOURCE=Interface_IComparable.fsx SCFLAGS= # Interface_IComparable.fsx - [] + [] let ``Interface_IComparable_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //SOURCE=Member01.fsx # Member01.fsx - [] + [] let ``Member01_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //SOURCE=NamedFields01.fsx SCFLAGS= # NamedFields01.fsx - [] + [] let ``NamedFields01_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //SOURCE=NamedFields02.fsx SCFLAGS= # NamedFields02.fsx - [] + [] let ``NamedFields02_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //SOURCE=NamedFields03.fsx SCFLAGS= # NamedFields03.fsx - [] + [] let ``NamedFields03_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/BasicTypeAndModuleDefinitions/UnionTypes) - [] + [] let ``Overload_Equals_fs`` compilation = compilation + |> getCompilation |> asFsx |> verifyCompile |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/BasicTypeAndModuleDefinitions/UnionTypes) - [] + [] let ``Overload_GetHashCode_fs`` compilation = compilation + |> getCompilation |> asFsx |> verifyCompile |> shouldSucceed // This test was automatically generated (moved from FSharpQA suite - Conformance/BasicTypeAndModuleDefinitions/UnionTypes) - [] + [] let ``Overload_ToString_fs`` compilation = compilation + |> getCompilation |> asFsx |> verifyCompile |> shouldSucceed //SOURCE=Overrides01.fsx # Overrides01.fsx - [] + [] let ``Overrides01_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //SOURCE=Parenthesis01.fsx # Parenthesis01.fsx - [] + [] let ``Parenthesis01_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //SOURCE=Parenthesis02.fsx # Parenthesis02.fsx - [] + [] let ``Parenthesis02_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //SOURCE=Parenthesis03.fsx # Parenthesis03.fsx - [] + [] let ``Parenthesis03_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //SOURCE=Recursive01.fsx SCFLAGS= # Recursive01.fsx - [] + [] let ``Recursive01_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //SOURCE=ReflectionOnUnionTypes01.fs SCFLAGS= # ReflectionOnUnionTypes01.fs - [] + [] let ``ReflectionOnUnionTypes01_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //SOURCE=SampleFromSpec01.fsx SCFLAGS # SampleFromSpec01.fsx - [] + [] let ``SampleFromSpec01_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //SOURCE=SampleFromSpec01b.fsx SCFLAGS= # SampleFromSpec01b.fsx - [] + [] let ``SampleFromSpec01b_fsx`` compilation = compilation + |> getCompilation |> withOcamlCompat |> withLangVersion50 |> verifyCompileAndRun |> shouldSucceed //SOURCE=SampleFromSpec01d.fsx SCFLAGS= # SampleFromSpec01d.fsx - [] + [] let ``SampleFromSpec01d_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //SOURCE=ScopeAndDataConstrAndPattern01.fsx SCFLAGS= # ScopeAndDataConstrAndPattern01.fsx - [] + [] let ``ScopeAndDataConstrAndPattern01_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //SOURCE=UnionCaseProduction01.fsx SCFLAGS=-a # UnionCaseProduction01.fsx - [] + [] let ``UnionCaseProduction01_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //SOURCE=UnionCasesProduction01.fsx SCFLAGS=-a # UnionCasesProduction01.fsx - [] + [] let ``UnionCasesProduction01_fsx`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //SOURCE=UnionsNotNull02.fs # UnionsNotNull02.fs - [] + [] let ``UnionsNotNull02_fs`` compilation = compilation + |> getCompilation |> verifyCompileAndRun |> shouldSucceed //SOURCE=LowercaseWhenRequireQualifiedAccess.fsx # LowercaseWhenRequireQualifiedAccess.fsx - [] + [] let ``LowercaseWhenRequireQualifiedAccess_fs in langversion 6`` compilation = compilation + |> getCompilation |> withLangVersion60 |> verifyCompile |> shouldFail //SOURCE=LowercaseWhenRequireQualifiedAccess.fsx # LowercaseWhenRequireQualifiedAccess.fsx - [] + [] let ``LowercaseWhenRequireQualifiedAccess_fs in preview`` compilation = compilation + |> getCompilation |> withLangVersion70 |> verifyCompileAndRun |> shouldSucceed //SOURCE=E_LowercaseWhenRequireQualifiedAccess.fsx # E_LowercaseWhenRequireQualifiedAccess.fsx - [] + [] let ``E_LowercaseWhenRequireQualifiedAccess_fs in preview`` compilation = compilation + |> getCompilation |> withLangVersion70 |> verifyCompile |> shouldFail @@ -552,9 +609,10 @@ module UnionTypes = ] //SOURCE=E_LowercaseWhenRequireQualifiedAccess.fsx # E_LowercaseWhenRequireQualifiedAccess.fsx - [] + [] let ``E_LowercaseWhenRequireQualifiedAccess_fs in langversion 6`` compilation = compilation + |> getCompilation |> withLangVersion60 |> verifyCompile |> shouldFail @@ -581,9 +639,10 @@ module UnionTypes = ] //SOURCE=W_GenericFunctionValuedStaticProp02.fs SCFLAGS="--test:ErrorRanges --warnaserror-" # W_GenericFunctionValuedStaticProp02.fs - [] + [] let ``W_GenericFunctionValuedStaticProp02_fs`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -591,9 +650,10 @@ module UnionTypes = ] //SOURCE=W_SampleFromSpec01c.fsx SCFLAGS="--test:ErrorRanges" # W_SampleFromSpec01c.fsx - [] + [] let ``W_SampleFromSpec01c_fsx`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -603,9 +663,10 @@ module UnionTypes = ] //SOURCE=W_UnionCaseProduction01.fsx SCFLAGS="-a --test:ErrorRanges" # W_UnionCaseProduction01.fsx - [] + [] let ``W_UnionCaseProduction01_fsx`` compilation = compilation + |> getCompilation |> verifyCompile |> shouldFail |> withDiagnostics [ diff --git a/tests/FSharp.Compiler.ComponentTests/ConstraintSolver/PrimitiveConstraints.fs b/tests/FSharp.Compiler.ComponentTests/ConstraintSolver/PrimitiveConstraints.fs index 34942501f1d..24f3b6250c8 100644 --- a/tests/FSharp.Compiler.ComponentTests/ConstraintSolver/PrimitiveConstraints.fs +++ b/tests/FSharp.Compiler.ComponentTests/ConstraintSolver/PrimitiveConstraints.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace ConstraintSolver @@ -13,9 +13,10 @@ module PrimitiveConstraints = /// This suggestion was resolved as by design, /// so the test makes sure, we're emitting error message about 'not being a valid object construction expression' - [] + [] let ``Invalid object constructor`` compilation = // Regression test for FSharp1.0:4189 compilation + |> getCompilation |> verifyBaseline [] diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnionCasePatternMatchingErrors.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnionCasePatternMatchingErrors.fs index df94ca89e0e..6cffe31c236 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnionCasePatternMatchingErrors.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnionCasePatternMatchingErrors.fs @@ -1,12 +1,14 @@ -module ErrorMessages.UnionCasePatternMatchingErrors +namespace ErrorMessages open FSharp.Test open Xunit open FSharp.Test.Compiler -[] -let ``Union matching error - Incomplete union fields`` () = - FSharp """ +module UnionCasePatternMatchingErrors = + + [] + let ``Union matching error - Incomplete union fields`` () = + FSharp """ module Tests type U = | B of f1:int list * {|X:string|} * f3:U * f4: (int * System.String) @@ -15,18 +17,18 @@ let x : U = failwith "" let myVal = match x with | B -> 42""" - |> typecheck - |> shouldFail - |> withSingleDiagnostic (Error 727, Line 9, Col 7, Line 9, Col 8, - "This union case expects 4 arguments in tupled form, but was given 0. The missing field arguments may be any of: + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 727, Line 9, Col 7, Line 9, Col 8, + "This union case expects 4 arguments in tupled form, but was given 0. The missing field arguments may be any of: \tf1: int list \t{| X: string |} \tf3: U \tf4: (int * System.String)") -[] -let ``Union matching error - Named args - Name used twice`` () = - FSharp """ + [] + let ``Union matching error - Named args - Name used twice`` () = + FSharp """ module Tests type U = | B of field: int * int @@ -34,13 +36,13 @@ let x : U = failwith "" let myVal = match x with | B (field = x; field = z) -> let y = x + z + 1 in ()""" - |> typecheck - |> shouldFail - |> withSingleDiagnostic (Error 3175, Line 8, Col 21, Line 8, Col 26, "Union case/exception field 'field' cannot be used more than once.") + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 3175, Line 8, Col 21, Line 8, Col 26, "Union case/exception field 'field' cannot be used more than once.") -[] -let ``Union matching error - Multiple tupled args`` () = - FSharp """ + [] + let ``Union matching error - Multiple tupled args`` () = + FSharp """ module Tests type U = | B of field: int * int @@ -49,15 +51,15 @@ let x : U = failwith "" let myVal = match x with | B x z -> let y = x + z + 1 in ()""" - |> typecheck - |> shouldFail - |> withSingleDiagnostic (Error 727, Line 9, Col 7, Line 9, Col 12, "This union case expects 2 arguments in tupled form, but was given 0. The missing field arguments may be any of: + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 727, Line 9, Col 7, Line 9, Col 12, "This union case expects 2 arguments in tupled form, but was given 0. The missing field arguments may be any of: \tfield: int \tint") -[] -let ``Union matching error - Missing field`` () = - FSharp """ + [] + let ``Union matching error - Missing field`` () = + FSharp """ module Tests type U = | A @@ -67,14 +69,14 @@ let myVal = match A with | A -> 15 | B (x, _) -> 16""" - |> typecheck - |> shouldFail - |> withSingleDiagnostic (Error 727, Line 10, Col 7, Line 10, Col 15, "This union case expects 3 arguments in tupled form, but was given 2. The missing field arguments may be any of: + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 727, Line 10, Col 7, Line 10, Col 15, "This union case expects 3 arguments in tupled form, but was given 2. The missing field arguments may be any of: \tint") -[] -let ``Union Pattern discard not allowed for union case that takes no data with Lang preview`` () = - FSharp """ + [] + let ``Union Pattern discard not allowed for union case that takes no data with Lang preview`` () = + FSharp """ module Tests type X = X @@ -83,14 +85,14 @@ let x: X = X let myVal = match x with | X _ -> ()""" - |> withLangVersion80 - |> typecheck - |> shouldFail - |> withSingleDiagnostic (Warning 3548, Line 9, Col 7, Line 9, Col 10, "Pattern discard is not allowed for union case that takes no data.") + |> withLangVersion80 + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 3548, Line 9, Col 7, Line 9, Col 10, "Pattern discard is not allowed for union case that takes no data.") -[] -let ``Union Pattern discard allowed for union case that takes no data with Lang version 7`` () = - FSharp """ + [] + let ``Union Pattern discard allowed for union case that takes no data with Lang version 7`` () = + FSharp """ module Tests type X = X @@ -99,13 +101,13 @@ let x: X = X let myVal = match x with | X _ -> ()""" - |> withLangVersion70 - |> typecheck - |> shouldSucceed + |> withLangVersion70 + |> typecheck + |> shouldSucceed -[] -let ``Union function Pattern discard allowed for union case that takes no data with Lang version 7`` () = - FSharp """ + [] + let ``Union function Pattern discard allowed for union case that takes no data with Lang version 7`` () = + FSharp """ module Tests type X = X @@ -114,13 +116,13 @@ let x: X = X let myVal = function | X _ -> ()""" - |> withLangVersion70 - |> typecheck - |> shouldSucceed + |> withLangVersion70 + |> typecheck + |> shouldSucceed -[] -let ``Union function Pattern discard not allowed for union case that takes no data with Lang version preview`` () = - FSharp """ + [] + let ``Union function Pattern discard not allowed for union case that takes no data with Lang version preview`` () = + FSharp """ module Tests type X = X @@ -129,14 +131,14 @@ let x: X = X let myVal = function | X _ -> ()""" - |> withLangVersion80 - |> typecheck - |> shouldFail - |> withSingleDiagnostic (Warning 3548, Line 9, Col 7, Line 9, Col 10, "Pattern discard is not allowed for union case that takes no data.") + |> withLangVersion80 + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 3548, Line 9, Col 7, Line 9, Col 10, "Pattern discard is not allowed for union case that takes no data.") -[] -let ``Pattern discard not allowed for union case that takes no data with Lang preview`` () = - FSharp """ + [] + let ``Pattern discard not allowed for union case that takes no data with Lang preview`` () = + FSharp """ module Tests type U = | A @@ -150,14 +152,14 @@ let myVal = | A _ -> 15 | B (x, _, _) -> 16 | C _ -> 17""" - |> withLangVersion80 - |> typecheck - |> shouldFail - |> withSingleDiagnostic (Warning 3548, Line 12, Col 7, Line 12, Col 10, "Pattern discard is not allowed for union case that takes no data.") + |> withLangVersion80 + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 3548, Line 12, Col 7, Line 12, Col 10, "Pattern discard is not allowed for union case that takes no data.") -[] -let ``Pattern function discard not allowed for union case that takes no data with Lang preview`` () = - FSharp """ + [] + let ``Pattern function discard not allowed for union case that takes no data with Lang preview`` () = + FSharp """ module Tests type U = | A @@ -171,14 +173,14 @@ let myVal = | A _ -> 15 | B (x, _, _) -> 16 | C _ -> 17""" - |> withLangVersion80 - |> typecheck - |> shouldFail - |> withSingleDiagnostic (Warning 3548, Line 12, Col 7, Line 12, Col 10, "Pattern discard is not allowed for union case that takes no data.") + |> withLangVersion80 + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 3548, Line 12, Col 7, Line 12, Col 10, "Pattern discard is not allowed for union case that takes no data.") -[] -let ``Pattern discard allowed for union case that takes no data with Lang version 7`` () = - FSharp """ + [] + let ``Pattern discard allowed for union case that takes no data with Lang version 7`` () = + FSharp """ module Tests type U = | A @@ -192,13 +194,13 @@ let myVal = | A _ -> 15 | B (x, _, _) -> 16 | C _ -> 17""" - |> withLangVersion70 - |> typecheck - |> shouldSucceed + |> withLangVersion70 + |> typecheck + |> shouldSucceed -[] -let ``Grouped Pattern discard not allowed for union case that takes no data with Lang preview`` () = - FSharp """ + [] + let ``Grouped Pattern discard not allowed for union case that takes no data with Lang preview`` () = + FSharp """ module Tests type U = | A @@ -212,14 +214,14 @@ let myVal = | A _ | B _ | C _ -> 17""" - |> withLangVersion80 - |> typecheck - |> shouldFail - |> withSingleDiagnostic (Warning 3548, Line 12, Col 7, Line 12, Col 10, "Pattern discard is not allowed for union case that takes no data.") + |> withLangVersion80 + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 3548, Line 12, Col 7, Line 12, Col 10, "Pattern discard is not allowed for union case that takes no data.") -[] -let ``Multiple pattern discards not allowed for union case that takes no data with Lang preview`` () = - FSharp """ + [] + let ``Multiple pattern discards not allowed for union case that takes no data with Lang preview`` () = + FSharp """ module Tests type U = | A @@ -237,17 +239,17 @@ let myVal = | A _, D -> 15 | B (x, _, _), D _ -> 16 | C _, _ -> 17""" - |> withLangVersion80 - |> typecheck - |> shouldFail - |> withDiagnostics [ - (Warning 3548, Line 16, Col 7, Line 16, Col 10, "Pattern discard is not allowed for union case that takes no data.") - (Warning 3548, Line 17, Col 20, Line 17, Col 23, "Pattern discard is not allowed for union case that takes no data.") - ] + |> withLangVersion80 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 3548, Line 16, Col 7, Line 16, Col 10, "Pattern discard is not allowed for union case that takes no data.") + (Warning 3548, Line 17, Col 20, Line 17, Col 23, "Pattern discard is not allowed for union case that takes no data.") + ] -[] -let ``Multiple pattern discards not allowed for union case that takes no data with Lang 7`` () = - FSharp """ + [] + let ``Multiple pattern discards not allowed for union case that takes no data with Lang 7`` () = + FSharp """ module Tests type U = | A @@ -265,13 +267,13 @@ let myVal = | A _, D -> 15 | B (x, _, _), D _ -> 16 | C _, _ -> 17""" - |> withLangVersion70 - |> typecheck - |> shouldSucceed + |> withLangVersion70 + |> typecheck + |> shouldSucceed -[] -let ``Multiple function pattern discards is not allowed for union case that takes no data with Lang preview`` () = - FSharp """ + [] + let ``Multiple function pattern discards is not allowed for union case that takes no data with Lang preview`` () = + FSharp """ module Tests type U = | A @@ -289,17 +291,17 @@ let myVal = | A _, D -> 15 | B (x, _, _), D _ -> 16 | C _, _ -> 17""" - |> withLangVersion80 - |> typecheck - |> shouldFail - |> withDiagnostics [ - (Warning 3548, Line 16, Col 7, Line 16, Col 10, "Pattern discard is not allowed for union case that takes no data.") - (Warning 3548, Line 17, Col 20, Line 17, Col 23, "Pattern discard is not allowed for union case that takes no data.") - ] + |> withLangVersion80 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 3548, Line 16, Col 7, Line 16, Col 10, "Pattern discard is not allowed for union case that takes no data.") + (Warning 3548, Line 17, Col 20, Line 17, Col 23, "Pattern discard is not allowed for union case that takes no data.") + ] -[] -let ``Multiple function pattern discards is not allowed for union case that takes no data with Lang 7`` () = - FSharp """ + [] + let ``Multiple function pattern discards is not allowed for union case that takes no data with Lang 7`` () = + FSharp """ module Tests type U = | A @@ -318,62 +320,64 @@ let myVal = | A _, D -> 15 | B (x, _, _), D _ -> 16 | C _, _ -> 17""" - |> withLangVersion70 - |> typecheck - |> shouldSucceed + |> withLangVersion70 + |> typecheck + |> shouldSucceed -[] -let ``Pattern named not allowed union case does not take any arguments with Lang 7`` compilation = - compilation - |> asFs - |> withLangVersion70 - |> withOptions ["--nowarn:25"] - |> typecheck - |> shouldFail - |> withDiagnostics [ - (Error 725, Line 8, Col 3, Line 8, Col 9, "This union case does not take arguments"); - (Error 725, Line 11, Col 3, Line 11, Col 14, "This union case does not take arguments") - (Error 725, Line 14, Col 3, Line 14, Col 10, "This union case does not take arguments") - (Error 725, Line 17, Col 3, Line 17, Col 12, "This union case does not take arguments") - (Error 725, Line 20, Col 3, Line 20, Col 17, "This union case does not take arguments") - (Error 725, Line 23, Col 3, Line 23, Col 13, "This union case does not take arguments") - (Error 725, Line 26, Col 3, Line 26, Col 14, "This union case does not take arguments") - (Error 725, Line 29, Col 3, Line 29, Col 13, "This union case does not take arguments") - (Error 725, Line 35, Col 3, Line 35, Col 9, "This union case does not take arguments") - (Error 725, Line 38, Col 3, Line 38, Col 14, "This union case does not take arguments") - (Error 725, Line 42, Col 3, Line 42, Col 11, "This union case does not take arguments") - (Error 725, Line 48, Col 3, Line 48, Col 8, "This union case does not take arguments") - (Error 725, Line 51, Col 3, Line 51, Col 7, "This union case does not take arguments") - (Error 725, Line 55, Col 25, Line 55, Col 28, "This union case does not take arguments") - (Error 725, Line 57, Col 25, Line 57, Col 29, "This union case does not take arguments") - (Error 725, Line 59, Col 24, Line 59, Col 32, "This union case does not take arguments") - ] + [] + let ``Pattern named not allowed union case does not take any arguments with Lang 7`` compilation = + compilation + |> getCompilation + |> asFs + |> withLangVersion70 + |> withOptions ["--nowarn:25"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 725, Line 8, Col 3, Line 8, Col 9, "This union case does not take arguments"); + (Error 725, Line 11, Col 3, Line 11, Col 14, "This union case does not take arguments") + (Error 725, Line 14, Col 3, Line 14, Col 10, "This union case does not take arguments") + (Error 725, Line 17, Col 3, Line 17, Col 12, "This union case does not take arguments") + (Error 725, Line 20, Col 3, Line 20, Col 17, "This union case does not take arguments") + (Error 725, Line 23, Col 3, Line 23, Col 13, "This union case does not take arguments") + (Error 725, Line 26, Col 3, Line 26, Col 14, "This union case does not take arguments") + (Error 725, Line 29, Col 3, Line 29, Col 13, "This union case does not take arguments") + (Error 725, Line 35, Col 3, Line 35, Col 9, "This union case does not take arguments") + (Error 725, Line 38, Col 3, Line 38, Col 14, "This union case does not take arguments") + (Error 725, Line 42, Col 3, Line 42, Col 11, "This union case does not take arguments") + (Error 725, Line 48, Col 3, Line 48, Col 8, "This union case does not take arguments") + (Error 725, Line 51, Col 3, Line 51, Col 7, "This union case does not take arguments") + (Error 725, Line 55, Col 25, Line 55, Col 28, "This union case does not take arguments") + (Error 725, Line 57, Col 25, Line 57, Col 29, "This union case does not take arguments") + (Error 725, Line 59, Col 24, Line 59, Col 32, "This union case does not take arguments") + ] -[] -let ``Pattern named not allowed union case does not take any arguments with Lang preview`` compilation = - compilation - |> asFs - |> withLangVersion80 - |> withOptions ["--nowarn:25"] - |> typecheck - |> shouldFail - |> withDiagnostics [ - (Error 725, Line 8, Col 3, Line 8, Col 9, "This union case does not take arguments") - (Error 725, Line 11, Col 3, Line 11, Col 14, "This union case does not take arguments") - (Error 725, Line 14, Col 3, Line 14, Col 10, "This union case does not take arguments") - (Error 725, Line 17, Col 3, Line 17, Col 12, "This union case does not take arguments") - (Error 725, Line 20, Col 3, Line 20, Col 17, "This union case does not take arguments") - (Error 725, Line 23, Col 3, Line 23, Col 13, "This union case does not take arguments") - (Error 725, Line 26, Col 3, Line 26, Col 14, "This union case does not take arguments") - (Error 725, Line 29, Col 3, Line 29, Col 13, "This union case does not take arguments") - (Warning 3548, Line 32, Col 3, Line 32, Col 9, "Pattern discard is not allowed for union case that takes no data.") - (Error 725, Line 35, Col 3, Line 35, Col 9, "This union case does not take arguments") - (Error 725, Line 38, Col 3, Line 38, Col 14, "This union case does not take arguments") - (Error 725, Line 42, Col 3, Line 42, Col 11, "This union case does not take arguments") - (Error 725, Line 48, Col 3, Line 48, Col 8, "This union case does not take arguments") - (Error 725, Line 51, Col 3, Line 51, Col 7, "This union case does not take arguments") - (Warning 3548, Line 53, Col 24, Line 53, Col 27, "Pattern discard is not allowed for union case that takes no data.") - (Error 725, Line 55, Col 25, Line 55, Col 28, "This union case does not take arguments") - (Error 725, Line 57, Col 25, Line 57, Col 29, "This union case does not take arguments") - (Error 725, Line 59, Col 24, Line 59, Col 32, "This union case does not take arguments") - ] \ No newline at end of file + [] + let ``Pattern named not allowed union case does not take any arguments with Lang preview`` compilation = + compilation + |> getCompilation + |> asFs + |> withLangVersion80 + |> withOptions ["--nowarn:25"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 725, Line 8, Col 3, Line 8, Col 9, "This union case does not take arguments") + (Error 725, Line 11, Col 3, Line 11, Col 14, "This union case does not take arguments") + (Error 725, Line 14, Col 3, Line 14, Col 10, "This union case does not take arguments") + (Error 725, Line 17, Col 3, Line 17, Col 12, "This union case does not take arguments") + (Error 725, Line 20, Col 3, Line 20, Col 17, "This union case does not take arguments") + (Error 725, Line 23, Col 3, Line 23, Col 13, "This union case does not take arguments") + (Error 725, Line 26, Col 3, Line 26, Col 14, "This union case does not take arguments") + (Error 725, Line 29, Col 3, Line 29, Col 13, "This union case does not take arguments") + (Warning 3548, Line 32, Col 3, Line 32, Col 9, "Pattern discard is not allowed for union case that takes no data.") + (Error 725, Line 35, Col 3, Line 35, Col 9, "This union case does not take arguments") + (Error 725, Line 38, Col 3, Line 38, Col 14, "This union case does not take arguments") + (Error 725, Line 42, Col 3, Line 42, Col 11, "This union case does not take arguments") + (Error 725, Line 48, Col 3, Line 48, Col 8, "This union case does not take arguments") + (Error 725, Line 51, Col 3, Line 51, Col 7, "This union case does not take arguments") + (Warning 3548, Line 53, Col 24, Line 53, Col 27, "Pattern discard is not allowed for union case that takes no data.") + (Error 725, Line 55, Col 25, Line 55, Col 28, "This union case does not take arguments") + (Error 725, Line 57, Col 25, Line 57, Col 29, "This union case does not take arguments") + (Error 725, Line 59, Col 24, Line 59, Col 32, "This union case does not take arguments") + ] \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 3ff3f070dc0..b96aba6777b 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -64,7 +64,7 @@ - + diff --git a/tests/FSharp.Compiler.ComponentTests/Globalization/GlobalizationTestCases.fs b/tests/FSharp.Compiler.ComponentTests/Globalization/GlobalizationTestCases.fs index 536ad488203..d5fad6b87ca 100644 --- a/tests/FSharp.Compiler.ComponentTests/Globalization/GlobalizationTestCases.fs +++ b/tests/FSharp.Compiler.ComponentTests/Globalization/GlobalizationTestCases.fs @@ -10,56 +10,57 @@ module ``Globalization Test Cases`` = let ``Compile global source file`` compilation = compilation + |> getCompilation |> asExe |> ignoreWarnings |> compile |> shouldSucceed |> withDiagnostics [ ] - [] + [] let ``Compile Arabic source file`` compilation = ``Compile global source file`` compilation - [] + [] let ``Compile gb18030 source file`` compilation = ``Compile global source file`` compilation - [] + [] let ``Compile HexCharEncode source file`` compilation = ``Compile global source file`` compilation - [] + [] let ``Compile Hindi source file`` compilation = ``Compile global source file`` compilation - [] + [] let ``Compile Mongolian source file`` compilation = ``Compile global source file`` compilation - [] + [] let ``Compile RightToLeft source file`` compilation = ``Compile global source file`` compilation - [] + [] let ``Compile Surrogates source file`` compilation = ``Compile global source file`` compilation - [] + [] let ``Compile Tamil source file`` compilation = ``Compile global source file`` compilation - [] + [] let ``Compile Tibetan source file`` compilation = ``Compile global source file`` compilation - [] + [] let ``Compile utf16 source file`` compilation = ``Compile global source file`` compilation - [] + [] let ``Compile utf8 source file`` compilation = ``Compile global source file`` compilation - [] + [] let ``Compile Yi source file`` compilation = ``Compile global source file`` compilation diff --git a/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressions/SequenceExpressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressions/SequenceExpressionTests.fs index 9d98106bcdb..d64262e856b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressions/SequenceExpressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressions/SequenceExpressionTests.fs @@ -1,22 +1,23 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -// Run sequentially because of shared fsiSession. -[] -module Language.SequenceExpression.SequenceExpressionTests +namespace Language open FSharp.Test open Xunit open FSharp.Test.Compiler open FSharp.Test.ScriptHelpers +// Run sequentially because of shared fsiSession. +[] +module SequenceExpression = -let fsiSession = getSessionForEval [||] LangVersion.Preview + let fsiSession = getSessionForEval [||] LangVersion.Preview -let runCode = evalInSharedSession fsiSession + let runCode = evalInSharedSession fsiSession -[] -let ``Basic recursive case uses tail recursion``() = - Fsx """ + [] + let ``Basic recursive case uses tail recursion``() = + Fsx """ let rec f () = seq { try yield 123 @@ -25,44 +26,44 @@ let rec f () = seq { yield 789 yield! f() } - """ - |> withLangVersion80 - |> compile - |> verifyIL [" - .class auto ansi serializable sealed nested assembly beforefieldinit 'f@3-1' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> - { - .field static assembly initonly class Test/'f@3-1' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + """ + |> withLangVersion80 + |> compile + |> verifyIL [" + .class auto ansi serializable sealed nested assembly beforefieldinit 'f@3-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> + { + .field static assembly initonly class Test/'f@3-1' @_instance + .method assembly specialname rtspecialname + instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() - IL_0006: ret - } - - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerable`1 - Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed - { + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() + IL_0006: ret + } + + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerable`1 + Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed + { - .maxstack 8 - IL_0000: ldc.i4.s 123 - IL_0002: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::Singleton(!!0) - IL_0007: ldsfld class Test/'f@5-2' Test/'f@5-2'::@_instance - IL_000c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0011: tail. - IL_0013: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::Append(class [runtime]System.Collections.Generic.IEnumerable`1, - class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0018: ret - } "] - -[] -let ``A seq{try/with} happy path with multiple language elements``() = - Fsx """ + .maxstack 8 + IL_0000: ldc.i4.s 123 + IL_0002: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::Singleton(!!0) + IL_0007: ldsfld class Test/'f@5-2' Test/'f@5-2'::@_instance + IL_000c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0011: tail. + IL_0013: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::Append(class [runtime]System.Collections.Generic.IEnumerable`1, + class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0018: ret + } "] + + [] + let ``A seq{try/with} happy path with multiple language elements``() = + Fsx """ let rec mySeq inputEnumerable = seq { for x in inputEnumerable do @@ -85,13 +86,13 @@ let rec mySeq inputEnumerable = if (mySeq [0..5] |> Seq.sum) <> (1+(1+3)+3+4+5+5) then failwith $"Sum was {(mySeq [0..5] |> Seq.sum)} instead" - """ - |> runCode - |> shouldSucceed + """ + |> runCode + |> shouldSucceed -[] -let ``Inner try-finally's Dispose is executed before yielding from outer try-with``() = - Fsx """ + [] + let ``Inner try-finally's Dispose is executed before yielding from outer try-with``() = + Fsx """ let mutable l = [] let s() = seq { try @@ -124,16 +125,16 @@ let expectedList = "After sum"] if l<> expectedList then failwith $" List is %A{l}" - """ - |> runCode - |> shouldSucceed - -[] -[] -[] -[] -let ``A sequence expression can recurse itself from with clause``(recLevel:int) = - Fsx $""" + """ + |> runCode + |> shouldSucceed + + [] + [] + [] + [] + let ``A sequence expression can recurse itself from with clause``(recLevel:int) = + Fsx $""" let rec f () = seq {{ try yield 1 @@ -144,13 +145,13 @@ let rec f () = seq {{ let topNsum = f() |> Seq.take {recLevel} |> Seq.sum if topNsum <> {recLevel} then failwith $"Sum was {{topNsum}} instead" - """ - |> runCode - |> shouldSucceed + """ + |> runCode + |> shouldSucceed -[] -let ``A sequence expression can yield from with clause``() = - Fsx """ + [] + let ``A sequence expression can yield from with clause``() = + Fsx """ let sum = seq { for x in [0;1] do @@ -162,13 +163,13 @@ let sum = |> Seq.sum if sum <> 110 then failwith $"Sum was {sum} instead" - """ - |> runCode - |> shouldSucceed + """ + |> runCode + |> shouldSucceed -[] -let ``A sequence expression can have try-with around foreach``() = - Fsx """ + [] + let ``A sequence expression can have try-with around foreach``() = + Fsx """ let mySeq (providedInput: seq) = seq { try @@ -180,13 +181,13 @@ let mySeq (providedInput: seq) = let mySum = (mySeq [3;2;1;0]) |> Seq.sum if mySum <> (6/3 + 6/2 + 6/1 + 100) then failwith $"Sum was {mySum} instead" - """ - |> runCode - |> shouldSucceed + """ + |> runCode + |> shouldSucceed -[] -let ``A sequence expression can have try-with around while``() = - Fsx """ + [] + let ``A sequence expression can have try-with around while``() = + Fsx """ let mySeq () = seq { let mutable x = 3 @@ -200,13 +201,13 @@ let mySeq () = let mySum = (mySeq () |> Seq.truncate 10) |> Seq.sum if mySum <> (6/3 + 6/2 + 6/1 + 100) then failwith $"Sum was {mySum} instead" - """ - |> runCode - |> shouldSucceed + """ + |> runCode + |> shouldSucceed -[] -let ``A sequence expression can yield! from with clause``() = - Fsx """ + [] + let ``A sequence expression can yield! from with clause``() = + Fsx """ let sum = seq { for x in [0;1] do @@ -218,13 +219,13 @@ let sum = |> Seq.sum if sum <> 16 then failwith $"Sum was {sum} instead" - """ - |> runCode - |> shouldSucceed + """ + |> runCode + |> shouldSucceed -[] -let ``A sequence expression can fail later in try/with and still get caught``() = - Fsx """ + [] + let ``A sequence expression can fail later in try/with and still get caught``() = + Fsx """ let sum = seq { try @@ -238,13 +239,13 @@ let sum = |> Seq.sum if sum <> (1+2+3) then failwith $"Sum was {sum} instead" - """ - |> runCode - |> shouldSucceed + """ + |> runCode + |> shouldSucceed -[] -let ``A sequence expression can have inner seq{try/with} in an outer try/with``() = - Fsx """ + [] + let ``A sequence expression can have inner seq{try/with} in an outer try/with``() = + Fsx """ let sum = seq { try @@ -256,13 +257,13 @@ let sum = |> Seq.sum if sum <> (1+1+1) then failwith $"Sum was {sum} instead" - """ - |> runCode - |> shouldSucceed + """ + |> runCode + |> shouldSucceed -[] -let ``A sequence expression can do multiple yields from try/with clause``() = - Fsx """ + [] + let ``A sequence expression can do multiple yields from try/with clause``() = + Fsx """ let sum = seq { for x in [0;1] do @@ -277,13 +278,13 @@ let sum = |> Seq.sum if sum <> (1+100+100+1+10+2) then failwith $"Sum was {sum} instead" - """ - |> runCode - |> shouldSucceed + """ + |> runCode + |> shouldSucceed -[] -let ``A sequence expression can yield from try and have empty with``() = - Fsx """ + [] + let ``A sequence expression can yield from try and have empty with``() = + Fsx """ let sum = seq { for x in [1;0] do @@ -295,13 +296,13 @@ let sum = |> Seq.sum if sum <> 10 then failwith $"Sum was {sum} instead" - """ - |> runCode - |> shouldSucceed + """ + |> runCode + |> shouldSucceed -[] -let ``A sequence expression can yield from with and have empty try``() = - Fsx """ + [] + let ``A sequence expression can yield from with and have empty try``() = + Fsx """ let sum = seq { for x in [1;0] do @@ -314,14 +315,14 @@ let sum = |> Seq.sum if sum <> 100 then failwith $"Sum was {sum} instead" - """ - |> runCode - |> shouldSucceed + """ + |> runCode + |> shouldSucceed -[] -let ``A sequence expression can have implicit yields in try-with``() = - Fsx """ + [] + let ``A sequence expression can have implicit yields in try-with``() = + Fsx """ let sum = seq { for x in [0;1] do @@ -333,14 +334,14 @@ let sum = |> Seq.sum if sum <> 110 then failwith $"Sum was {sum} instead" - """ - |> runCode - |> shouldSucceed + """ + |> runCode + |> shouldSucceed -[] -let ``With clause in seq expression can bind specific exn type``() = + [] + let ``With clause in seq expression can bind specific exn type``() = - Fsx """ + Fsx """ open System let whatIsIt = seq { @@ -350,24 +351,24 @@ let whatIsIt = | :? AggregateException as exc when (exc.InnerException :? OperationCanceledException) -> () } |> Seq.head - """ - |> compile - |> verifyIL [ - """IL_0000: ldarg.1 - IL_0001: isinst [runtime]System.AggregateException - IL_0006: stloc.0 - IL_0007: ldloc.0"""; - - """IL_000a: ldloc.0 - IL_000b: callvirt instance class [runtime]System.Exception [runtime]System.Exception::get_InnerException() - IL_0010: stloc.1 - IL_0011: ldloc.1 - IL_0012: isinst [runtime]System.OperationCanceledException"""] - -[] -let ``With clause in seq expression can bind many exn subtypes``() = - - Fsx """ + """ + |> compile + |> verifyIL [ + """IL_0000: ldarg.1 + IL_0001: isinst [runtime]System.AggregateException + IL_0006: stloc.0 + IL_0007: ldloc.0"""; + + """IL_000a: ldloc.0 + IL_000b: callvirt instance class [runtime]System.Exception [runtime]System.Exception::get_InnerException() + IL_0010: stloc.1 + IL_0011: ldloc.1 + IL_0012: isinst [runtime]System.OperationCanceledException"""] + + [] + let ``With clause in seq expression can bind many exn subtypes``() = + + Fsx """ open System let whatIsIt = seq { @@ -381,17 +382,17 @@ let whatIsIt = | _ -> yield 1 } |> Seq.head - """ - |> runCode - |> shouldSucceed - -[] -[] -[] -[] -[] -let ``Propper type matching in seq{try/with} with implicit yield``(valInTry,valInWith1,valInWith2) = - Fsx $""" + """ + |> runCode + |> shouldSucceed + + [] + [] + [] + [] + [] + let ``Propper type matching in seq{try/with} with implicit yield``(valInTry,valInWith1,valInWith2) = + Fsx $""" let typedSeq = seq {{ for x in [0;1] do @@ -401,16 +402,16 @@ let typedSeq = |_ when x = 0 -> %s{valInWith1} |_ when x = 0 -> %s{valInWith2} }} - """ - |> withLangVersion80 - |> typecheck - |> shouldSucceed - -[] -[] -[] -let ``seq{try/with} using yield or implicit must be consistent``(valInTry,valInWith1,valInWith2) = - Fsx $""" + """ + |> withLangVersion80 + |> typecheck + |> shouldSucceed + + [] + [] + [] + let ``seq{try/with} using yield or implicit must be consistent``(valInTry,valInWith1,valInWith2) = + Fsx $""" let typedSeq = seq {{ for x in [0;1] do @@ -420,16 +421,16 @@ let typedSeq = |_ when x = 0 -> %s{valInWith1} |_ when x = 0 -> %s{valInWith2} }} - """ - |> withLangVersion80 - |> typecheck - |> shouldSucceed - -[] -[] -[] -let ``seq{try/with} mismatch implicit vs yield``(valInTry,valInWith1,valInWith2) = - Fsx $""" + """ + |> withLangVersion80 + |> typecheck + |> shouldSucceed + + [] + [] + [] + let ``seq{try/with} mismatch implicit vs yield``(valInTry,valInWith1,valInWith2) = + Fsx $""" let typedSeq = seq {{ for x in [0;1] do @@ -439,19 +440,19 @@ let typedSeq = |_ when x = 0 -> %s{valInWith1} |_ when x = 0 -> %s{valInWith2} }} - """ - |> withLangVersion80 - |> typecheck - |> shouldFail - |> withDiagnosticMessageMatches "This expression returns a value of type 'int' but is implicitly discarded." - |> withDiagnosticMessageMatches "If you intended to use the expression as a value in the sequence then use an explicit 'yield'." - -[] -[] -[] -[] -let ``Type mismatch error in seq{try/with}``(valInTry,valInWith1,valInWith2) = - Fsx $""" + """ + |> withLangVersion80 + |> typecheck + |> shouldFail + |> withDiagnosticMessageMatches "This expression returns a value of type 'int' but is implicitly discarded." + |> withDiagnosticMessageMatches "If you intended to use the expression as a value in the sequence then use an explicit 'yield'." + + [] + [] + [] + [] + let ``Type mismatch error in seq{try/with}``(valInTry,valInWith1,valInWith2) = + Fsx $""" let typedSeq = seq {{ for x in [0;1] do @@ -461,22 +462,22 @@ let typedSeq = |_ when x = 0 -> %s{valInWith1} |_ when x = 0 -> %s{valInWith2} }} - """ - |> withLangVersion80 - |> typecheck - |> shouldFail - |> withErrorCode 1 - |> withDiagnosticMessageMatches "This expression was expected to have type" - - -[] -let printCode = """ printfn "Hello there" """ - -[] -[] -[] -let ``Missing result type in seq{try/with}``(valInTry,valInWith1,valInWith2) = - Fsx $""" + """ + |> withLangVersion80 + |> typecheck + |> shouldFail + |> withErrorCode 1 + |> withDiagnosticMessageMatches "This expression was expected to have type" + + + [] + let printCode = """ printfn "Hello there" """ + + [] + [] + [] + let ``Missing result type in seq{try/with}``(valInTry,valInWith1,valInWith2) = + Fsx $""" let typedSeq = seq {{ for x in [0;1] do @@ -486,157 +487,161 @@ let typedSeq = |_ when x = 0 -> %s{valInWith1} |_ when x = 0 -> %s{valInWith2} }} - """ - |> withLangVersion80 - |> typecheck - |> shouldFail - |> withErrorCode 30 - |> withDiagnosticMessageMatches "Value restriction: The value 'typedSeq' has an inferred generic type" - |> withDiagnosticMessageMatches "val typedSeq: '_a seq" + """ + |> withLangVersion80 + |> typecheck + |> shouldFail + |> withErrorCode 30 + |> withDiagnosticMessageMatches "Value restriction: The value 'typedSeq' has an inferred generic type" + |> withDiagnosticMessageMatches "val typedSeq: '_a seq" -[] -let ``yield may only be used within list, array, and sequence expressions``() = - Fsx """ + [] + let ``yield may only be used within list, array, and sequence expressions``() = + Fsx """ let f1 = yield [ 3; 4 ] let f2 = yield! [ 3; 4 ] - """ - |> typecheck - |> shouldFail - |> withDiagnostics [ - (Error 747, Line 2, Col 10, Line 2, Col 15, "This construct may only be used within list, array and sequence expressions, e.g. expressions of the form 'seq { ... }', '[ ... ]' or '[| ... |]'. These use the syntax 'for ... in ... do ... yield...' to generate elements"); - (Error 747, Line 3, Col 10, Line 3, Col 16, "This construct may only be used within list, array and sequence expressions, e.g. expressions of the form 'seq { ... }', '[ ... ]' or '[| ... |]'. These use the syntax 'for ... in ... do ... yield...' to generate elements") - ] + """ + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 747, Line 2, Col 10, Line 2, Col 15, "This construct may only be used within list, array and sequence expressions, e.g. expressions of the form 'seq { ... }', '[ ... ]' or '[| ... |]'. These use the syntax 'for ... in ... do ... yield...' to generate elements"); + (Error 747, Line 3, Col 10, Line 3, Col 16, "This construct may only be used within list, array and sequence expressions, e.g. expressions of the form 'seq { ... }', '[ ... ]' or '[| ... |]'. These use the syntax 'for ... in ... do ... yield...' to generate elements") + ] -[] -let ``return may only be used within list, array, and sequence expressions``() = - Fsx """ + [] + let ``return may only be used within list, array, and sequence expressions``() = + Fsx """ let f1 = return [ 3; 4 ] let f2 = return! [ 3; 4 ] - """ - |> typecheck - |> shouldFail - |> withDiagnostics [ - (Error 748, Line 2, Col 10, Line 2, Col 16, "This construct may only be used within computation expressions. To return a value from an ordinary function simply write the expression without 'return'."); - (Error 748, Line 3, Col 10, Line 3, Col 17, "This construct may only be used within computation expressions. To return a value from an ordinary function simply write the expression without 'return'.") - ] - -[] -let ``Sequence(SynExpr.Sequential) expressions should be of the form 'seq { ... } lang version 9``() = - Fsx """ + """ + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 748, Line 2, Col 10, Line 2, Col 16, "This construct may only be used within computation expressions. To return a value from an ordinary function simply write the expression without 'return'."); + (Error 748, Line 3, Col 10, Line 3, Col 17, "This construct may only be used within computation expressions. To return a value from an ordinary function simply write the expression without 'return'.") + ] + + [] + let ``Sequence(SynExpr.Sequential) expressions should be of the form 'seq { ... } lang version 9``() = + Fsx """ { 1;10 } [| { 1;10 } |] let a = { 1;10 } let b = [| { 1;10 } |] let c = [ { 1;10 } ] - """ - |> withOptions [ "--nowarn:0020" ] - |> withLangVersion90 - |> typecheck - |> shouldFail - |> withDiagnostics [ - (Error 740, Line 2, Col 1, Line 2, Col 9, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") - (Error 740, Line 3, Col 4, Line 3, Col 12, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") - (Error 740, Line 4, Col 9, Line 4, Col 17, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") - (Error 740, Line 5, Col 12, Line 5, Col 20, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") - (Error 740, Line 6, Col 11, Line 6, Col 19, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") - ] + """ + |> withOptions [ "--nowarn:0020" ] + |> withLangVersion90 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 740, Line 2, Col 1, Line 2, Col 9, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") + (Error 740, Line 3, Col 4, Line 3, Col 12, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") + (Error 740, Line 4, Col 9, Line 4, Col 17, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") + (Error 740, Line 5, Col 12, Line 5, Col 20, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") + (Error 740, Line 6, Col 11, Line 6, Col 19, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") + ] -[] -let ``Sequence(SynExpr.Sequential) expressions should be of the form 'seq { ... } lang version preview``() = - Fsx """ + [] + let ``Sequence(SynExpr.Sequential) expressions should be of the form 'seq { ... } lang version preview``() = + Fsx """ { 1;10 } [| { 1;10 } |] let a = { 1;10 } let b = [| { 1;10 } |] let c = [ { 1;10 } ] - """ - |> withOptions [ "--nowarn:0020" ] - |> withLangVersionPreview - |> typecheck - |> shouldFail - |> withDiagnostics [ - (Error 740, Line 2, Col 1, Line 2, Col 9, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") - (Error 740, Line 3, Col 4, Line 3, Col 12, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") - (Error 740, Line 4, Col 9, Line 4, Col 17, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") - (Error 740, Line 5, Col 12, Line 5, Col 20, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") - (Error 740, Line 6, Col 11, Line 6, Col 19, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") - ] - -// SOURCE=E_SequenceExpressions01.fs # E_SequenceExpressions01.fs -[] -let ``E_SequenceExpressions01 lang version 9`` compilation = - compilation - |> withOptions [ "--nowarn:0020" ] - |> withLangVersion90 - |> typecheck - |> shouldSucceed - -// SOURCE=E_SequenceExpressions01.fs # E_SequenceExpressions01.fs -[] -let ``E_SequenceExpressions01 lang version preview`` compilation = - compilation - |> withOptions [ "--nowarn:0020" ] - |> withLangVersionPreview - |> typecheck - |> shouldFail - |> withDiagnostics [ - (Warning 3873, Line 1, Col 1, Line 1, Col 10, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 3, Col 1, Line 3, Col 13, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 5, Col 4, Line 5, Col 13, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 7, Col 4, Line 7, Col 16, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 9, Col 9, Line 9, Col 18, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 11, Col 10, Line 11, Col 23, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 13, Col 12, Line 13, Col 21, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 15, Col 13, Line 15, Col 26, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 17, Col 11, Line 17, Col 20, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 19, Col 4, Line 19, Col 13, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 21, Col 10, Line 21, Col 19, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 23, Col 3, Line 23, Col 12, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 25, Col 3, Line 25, Col 16, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 27, Col 9, Line 27, Col 18, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 29, Col 9, Line 29, Col 22, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 31, Col 13, Line 31, Col 22, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 33, Col 13, Line 33, Col 26, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 35, Col 34, Line 35, Col 51, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 37, Col 35, Line 37, Col 52, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 39, Col 10, Line 39, Col 19, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 41, Col 10, Line 41, Col 22, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 45, Col 12, Line 45, Col 20, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 47, Col 13, Line 47, Col 25, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 49, Col 14, Line 49, Col 22, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 51, Col 33, Line 51, Col 50, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 55, Col 12, Line 55, Col 21, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 57, Col 1, Line 57, Col 13, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 59, Col 28, Line 59, Col 34, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 61, Col 44, Line 61, Col 52, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 61, Col 53, Line 61, Col 61, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 61, Col 62, Line 61, Col 71, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 65, Col 17, Line 65, Col 23, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 65, Col 34, Line 65, Col 44, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 67, Col 7, Line 67, Col 13, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 67, Col 15, Line 67, Col 21, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 67, Col 23, Line 67, Col 30, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 69, Col 14, Line 69, Col 22, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 71, Col 24, Line 71, Col 32, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 73, Col 25, Line 73, Col 33, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 74, Col 25, Line 74, Col 33, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - (Warning 3873, Line 76, Col 13, Line 76, Col 20, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") - ] - -// SOURCE=SequenceExpressions01.fs # SequenceExpressions01.fs -[] -let ``SequenceExpressions01 lang version 9`` compilation = - compilation - |> withOptions [ "--nowarn:0020" ] - |> withLangVersion90 - |> typecheck - |> shouldSucceed + """ + |> withOptions [ "--nowarn:0020" ] + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 740, Line 2, Col 1, Line 2, Col 9, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") + (Error 740, Line 3, Col 4, Line 3, Col 12, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") + (Error 740, Line 4, Col 9, Line 4, Col 17, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") + (Error 740, Line 5, Col 12, Line 5, Col 20, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") + (Error 740, Line 6, Col 11, Line 6, Col 19, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'") + ] + + // SOURCE=E_SequenceExpressions01.fs # E_SequenceExpressions01.fs + [] + let ``E_SequenceExpressions01 lang version 9`` compilation = + compilation + |> getCompilation + |> withOptions [ "--nowarn:0020" ] + |> withLangVersion90 + |> typecheck + |> shouldSucceed + + // SOURCE=E_SequenceExpressions01.fs # E_SequenceExpressions01.fs + [] + let ``E_SequenceExpressions01 lang version preview`` compilation = + compilation + |> getCompilation + |> withOptions [ "--nowarn:0020" ] + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 3873, Line 1, Col 1, Line 1, Col 10, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 3, Col 1, Line 3, Col 13, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 5, Col 4, Line 5, Col 13, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 7, Col 4, Line 7, Col 16, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 9, Col 9, Line 9, Col 18, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 11, Col 10, Line 11, Col 23, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 13, Col 12, Line 13, Col 21, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 15, Col 13, Line 15, Col 26, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 17, Col 11, Line 17, Col 20, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 19, Col 4, Line 19, Col 13, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 21, Col 10, Line 21, Col 19, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 23, Col 3, Line 23, Col 12, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 25, Col 3, Line 25, Col 16, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 27, Col 9, Line 27, Col 18, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 29, Col 9, Line 29, Col 22, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 31, Col 13, Line 31, Col 22, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 33, Col 13, Line 33, Col 26, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 35, Col 34, Line 35, Col 51, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 37, Col 35, Line 37, Col 52, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 39, Col 10, Line 39, Col 19, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 41, Col 10, Line 41, Col 22, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 45, Col 12, Line 45, Col 20, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 47, Col 13, Line 47, Col 25, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 49, Col 14, Line 49, Col 22, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 51, Col 33, Line 51, Col 50, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 55, Col 12, Line 55, Col 21, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 57, Col 1, Line 57, Col 13, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 59, Col 28, Line 59, Col 34, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 61, Col 44, Line 61, Col 52, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 61, Col 53, Line 61, Col 61, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 61, Col 62, Line 61, Col 71, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 65, Col 17, Line 65, Col 23, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 65, Col 34, Line 65, Col 44, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 67, Col 7, Line 67, Col 13, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 67, Col 15, Line 67, Col 21, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 67, Col 23, Line 67, Col 30, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 69, Col 14, Line 69, Col 22, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 71, Col 24, Line 71, Col 32, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 73, Col 25, Line 73, Col 33, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 74, Col 25, Line 74, Col 33, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + (Warning 3873, Line 76, Col 13, Line 76, Col 20, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'") + ] + + // SOURCE=SequenceExpressions01.fs # SequenceExpressions01.fs + [] + let ``SequenceExpressions01 lang version 9`` compilation = + compilation + |> getCompilation + |> withOptions [ "--nowarn:0020" ] + |> withLangVersion90 + |> typecheck + |> shouldSucceed -// SOURCE=SequenceExpressions01.fs # SequenceExpressions01.fs -[] -let ``SequenceExpressions01 lang version preview`` compilation = - compilation - |> withOptions [ "--nowarn:0020" ] - |> withLangVersionPreview - |> typecheck - |> shouldSucceed \ No newline at end of file + // SOURCE=SequenceExpressions01.fs # SequenceExpressions01.fs + [] + let ``SequenceExpressions01 lang version preview`` compilation = + compilation + |> getCompilation + |> withOptions [ "--nowarn:0020" ] + |> withLangVersionPreview + |> typecheck + |> shouldSucceed \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/ListLiterals.fs b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/ListLiterals.fs index 8c560628592..c866b61212d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/ListLiterals.fs +++ b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/ListLiterals.fs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. namespace Miscellaneous @@ -8,9 +8,10 @@ open FSharp.Test.Compiler module ListLiterals = - [] + [] let ``List literals still have limited length in langversion 6`` compilation = compilation + |> getCompilation |> asFsx |> withLangVersion60 |> compile @@ -18,9 +19,10 @@ module ListLiterals = |> withErrorCode 742 |> withDiagnosticMessageMatches "This list expression exceeds the maximum size for list literals. Use an array for larger literals and call Array.ToList." - [] + [] let ``List literals have no limited length in langversion preview`` compilation = compilation + |> getCompilation |> asFsx |> withLangVersion70 |> compile diff --git a/tests/FSharp.Compiler.ComponentTests/OCamlCompat/OCamlCompat.fs b/tests/FSharp.Compiler.ComponentTests/OCamlCompat/OCamlCompat.fs index f3155e4c5cb..0e880debc61 100644 --- a/tests/FSharp.Compiler.ComponentTests/OCamlCompat/OCamlCompat.fs +++ b/tests/FSharp.Compiler.ComponentTests/OCamlCompat/OCamlCompat.fs @@ -9,9 +9,10 @@ open FSharp.Test.Compiler module ``OCamlCompat test cases`` = // SOURCE=E_IndentOff01.fs COMPILE_ONLY=1 SCFLAGS="--warnaserror --test:ErrorRanges" # E_IndentOff01.fs - [] + [] let ``E_IndentOff01_fs --warnaserror --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile @@ -21,9 +22,10 @@ module ``OCamlCompat test cases`` = ] - [] + [] let ``IndentOff02_fs --warnaserror"; "--mlcompatibility`` compilation = compilation + |> getCompilation |> asFsx |> withOcamlCompat |> withLangVersion50 @@ -32,9 +34,10 @@ module ``OCamlCompat test cases`` = //This construct is for ML compatibility\. Consider using a file with extension '\.ml' or '\.mli' instead\. You can disable this warning by using '--mlcompatibility' or '--nowarn:62'\.$ - [] + [] let ``W_IndentOff03_fs --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile @@ -45,9 +48,10 @@ module ``OCamlCompat test cases`` = //NoMT SOURCE=IndentOff04.fsx COMPILE_ONLY=1 SCFLAGS="--warnaserror --mlcompatibility" FSIMODE=PIPE # IndentOff04.fsx - [] + [] let ``IndentOff04_fsx --warnaserror --mlcompatibility`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> withOcamlCompat @@ -59,9 +63,10 @@ module ``OCamlCompat test cases`` = //NoMT SOURCE=W_IndentOff05.fsx COMPILE_ONLY=1 SCFLAGS="--test:ErrorRanges" FSIMODE=PIPE # W_IndentOff05.fsx - [] + [] let ``W_IndentOff05_fsx --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile @@ -72,9 +77,10 @@ module ``OCamlCompat test cases`` = //NoMT SOURCE=E_IndentOff06.fsx COMPILE_ONLY=1 SCFLAGS="--warnaserror" FSIMODE=PIPE # E_IndentOff06.fsx - [] + [] let ``E_IndentOff06_fsx --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile @@ -85,18 +91,20 @@ module ``OCamlCompat test cases`` = // SOURCE=E_mlExtension01.ml COMPILE_ONLY=1 SCFLAGS="--warnaserror --test:ErrorRanges" # E_mlExtension01.ml - [] + [] let ``E_mlExtension01_ml --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--test:ErrorRanges"] |> compile |> shouldSucceed // SOURCE=mlExtension02.ml COMPILE_ONLY=1 SCFLAGS="--warnaserror --mlcompatibility" # mlExtension02.ml - [] + [] let ``mlExtension02_ml --warnaserror --mlcompatibility`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--warnaserror"; "--mlcompatibility"] |> withLangVersion50 @@ -105,9 +113,10 @@ module ``OCamlCompat test cases`` = // SOURCE=W_mlExtension03.ml COMPILE_ONLY=1 SCFLAGS="--test:ErrorRanges" # W_mlExtension03.ml - [] + [] let `` W_mlExtension03_ml --test:ErrorRanges`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--test:ErrorRanges"] |> compile @@ -115,9 +124,10 @@ module ``OCamlCompat test cases`` = // SOURCE=Hat01.fs COMPILE_ONLY=1 SCFLAGS="--test:ErrorRanges" # Hat01.fs - [] + [] let ``Hat01_fs --warnaserror --mlcompatibility`` compilation = compilation + |> getCompilation |> asFsx |> withOptions ["--warnaserror"; "--mlcompatibility"] |> withLangVersion50 @@ -126,9 +136,10 @@ module ``OCamlCompat test cases`` = // SOURCE=W_Hat01.fs COMPILE_ONLY=1 SCFLAGS="--test:ErrorRanges" # W_Hat01.fs - [] + [] let ``W_Hat01_fs --warnaserror --mlcompatibility`` compilation = compilation + |> getCompilation |> asExe |> withOptions ["--test:ErrorRanges"; "--mlcompatibility"] |> withLangVersion50 @@ -137,18 +148,20 @@ module ``OCamlCompat test cases`` = // SOURCE=NoParensInLet01.fs COMPILE_ONLY=1 SCFLAGS="--test:ErrorRanges" # NoParensInLet01.fs - [] + [] let ``NoParensInLet01_fs`` compilation = compilation + |> getCompilation |> asExe |> compile |> shouldSucceed // SOURCE=W_MultiArgumentGenericType.fs # W_MultiArgumentGenericType.fs - [] + [] let ``W_MultiArgumentGenericType_fs``compilation = compilation + |> getCompilation |> asExe |> ignoreWarnings |> compile @@ -159,9 +172,10 @@ module ``OCamlCompat test cases`` = // SOURCE=OCamlStyleArrayIndexing.fs SCFLAGS="--mlcompatibility" # OCamlStyleArrayIndexing.fs - [] + [] let ``OCamlStyleArrayIndexing_fs --mlcompatibility`` compilation = compilation + |> getCompilation |> asExe |> withOcamlCompat |> withLangVersion50 From 400a8fa7e6d2378b4ff34ec21ba85f2073b9d805 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Tue, 7 Jan 2025 09:15:11 -0800 Subject: [PATCH 2/2] methordresolution --- .../MethodResolution/MethodResolution.fs | 133 ++++++++++++ .../OptionalAndOutParameters.fs | 9 + ...ameters.fs.RealInternalSignatureOff.il.bsl | 182 ++++++++++++++++ ...rameters.fs.RealInternalSignatureOn.il.bsl | 201 ++++++++++++++++++ 4 files changed, 525 insertions(+) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/MethodResolution.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs.RealInternalSignatureOff.il.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs.RealInternalSignatureOn.il.bsl diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/MethodResolution.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/MethodResolution.fs new file mode 100644 index 00000000000..74713d082ac --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/MethodResolution.fs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.BasicGrammarElements + +open FSharp.Test +open FSharp.Test.Compiler +open Xunit + +module MethodResolution = + + [] + let ``Method with optional and out parameters resolves correctly (sanity test)`` () = + FSharp """ +open System.Runtime.InteropServices + +type Thing = + static member Do(o: outref, []i: int) = + o <- i + i = 7 + +// We expect return value to be false, and out value to be 42 here. +let returnvalue1, value1 = Thing.Do(i = 42) +// Have explicit boolean check for readability here: +if returnvalue1 <> false && value1 <> 42 then + failwith "Mismatch: Return value should be false, and out value should be 42" + +// Here, we expect return value to be true, and out value to be 7 +let returnvalue2, value2 = Thing.Do() +// Have explicit boolean check for readability here: +if returnvalue2<> true && value2 <> 7 then + failwith "Mismatch: Return value should be true, and out value should be 7" + """ + |> typecheck + |> shouldSucceed + |> ignore + + [] + let ``OptionalAndOutParameters_fs`` compilation = + compilation + |> getCompilation + |> ignoreWarnings + |> verifyILBaseline + + [] + let ``Method with optional and out parameters resolves correctly (examples from original issue: https://github.com/dotnet/fsharp/issues/12515)`` () = + Fsx """ +open System.Runtime.InteropServices; + +// Define a member with both outref and default parameters. The compiler's implicit outref handling can handle this +// if required and optional parameters are provided, but not if the default parameters are left out + +type Thing = + static member Do(x: int, + fast: outref, + think: outref, + [] + token: System.Threading.CancellationToken + ) : bool = + true + static member Also(x: int, + [] + token: System.Threading.CancellationToken, + fast: outref, + think: outref + ) : bool = true + +// Works, was error because we can't strip the default `token` parameter for some reason +let ok, fast, think = Thing.Do(1) + +// works because the outrefs are detected and provided by the compiler +let ok2, fast2, think2 = Thing.Do(1, token = System.Threading.CancellationToken.None) + +// Works, was error because we can't strip the default `token` parameter for some reason +let ok3, fast3, think3 = Thing.Also(1) + +// works because the outrefs are detected and provided by the compiler +let ok4, fast4, think4 = Thing.Also(1, token = System.Threading.CancellationToken.None) + +// works but requires a lot of work for the user +let mutable fast5 = Unchecked.defaultof +let mutable think5 = Unchecked.defaultof + +let ok5 = Thing.Do(1, &fast5, &think5) + """ + + [] + let ``Method with same optional and out parameter does not resolve`` () = + Fsx """ +open System.Runtime.InteropServices + +type Thing = + static member Do([]i: outref) = true +let _, _ = Thing.Do() + """ + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 501, Line 6, Col 12, Line 6, Col 22, "The member or object constructor 'Do' takes 1 argument(s) but is here given 0. The required signature is 'static member Thing.Do: [] i: outref -> bool'.") + ] + + [] + let ``optional and ParamArray parameter resolves correctly `` () = + Fsx """ +open System.Runtime.InteropServices + +type Thing = + static member Do( + [] something: string, + [] args: obj[]) = something, args + static member Do2( + [] something: string, + outvar: outref, + [] args: obj[]) = + + outvar <- 1 + something, args +let _, _ = Thing.Do() +let _, _ = Thing.Do("123") +let _, _ = Thing.Do("123", 1, 2, 3, 4) + +let _, _ = Thing.Do2() +let _, _ = Thing.Do2("123") +let _ = + let mutable x = 0 + Thing.Do2("123", &x) +let _ = + let mutable x = 0 + Thing.Do2("123", &x, 1, 2, 3, 4) + """ + |> typecheck + |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs new file mode 100644 index 00000000000..29f58ce0db6 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs @@ -0,0 +1,9 @@ +module OutOptionalTests +open System.Runtime.InteropServices + +type Thing = + static member Do(o: outref, []i: int) = + o <- i + i = 7 +let (_:bool), (_:int) = Thing.Do(i = 42) +let (_:bool), (_:int) = Thing.Do() diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs.RealInternalSignatureOff.il.bsl new file mode 100644 index 00000000000..ab736a3c457 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs.RealInternalSignatureOff.il.bsl @@ -0,0 +1,182 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed OutOptionalTests + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public Thing + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .method public static bool Do([out] int32& o, + [opt] int32 i) cil managed + { + .param [2] = int32(0x00000001) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stobj [runtime]System.Int32 + IL_0007: ldarg.1 + IL_0008: ldc.i4.7 + IL_0009: ceq + IL_000b: ret + } + + } + + .method assembly specialname static class [runtime]System.Tuple`2 get_patternInput@8() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [runtime]System.Tuple`2 ''.$OutOptionalTests::patternInput@8 + IL_0005: ret + } + + .method assembly specialname static int32 get_outArg@8() cil managed + { + + .maxstack 8 + IL_0000: ldsfld int32 ''.$OutOptionalTests::outArg@8 + IL_0005: ret + } + + .method assembly specialname static void set_outArg@8(int32 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld int32 ''.$OutOptionalTests::outArg@8 + IL_0006: ret + } + + .method assembly specialname static class [runtime]System.Tuple`2 'get_patternInput@9-1'() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [runtime]System.Tuple`2 ''.$OutOptionalTests::'patternInput@9-1' + IL_0005: ret + } + + .method assembly specialname static int32 'get_outArg@9-1'() cil managed + { + + .maxstack 8 + IL_0000: ldsfld int32 ''.$OutOptionalTests::'outArg@9-1' + IL_0005: ret + } + + .method assembly specialname static void 'set_outArg@9-1'(int32 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld int32 ''.$OutOptionalTests::'outArg@9-1' + IL_0006: ret + } + + .property class [runtime]System.Tuple`2 + patternInput@8() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [runtime]System.Tuple`2 OutOptionalTests::get_patternInput@8() + } + .property int32 outArg@8() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void OutOptionalTests::set_outArg@8(int32) + .get int32 OutOptionalTests::get_outArg@8() + } + .property class [runtime]System.Tuple`2 + 'patternInput@9-1'() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [runtime]System.Tuple`2 OutOptionalTests::'get_patternInput@9-1'() + } + .property int32 'outArg@9-1'() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void OutOptionalTests::'set_outArg@9-1'(int32) + .get int32 OutOptionalTests::'get_outArg@9-1'() + } +} + +.class private abstract auto ansi sealed ''.$OutOptionalTests + extends [runtime]System.Object +{ + .field static assembly initonly class [runtime]System.Tuple`2 patternInput@8 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 outArg@8 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly initonly class [runtime]System.Tuple`2 'patternInput@9-1' + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 'outArg@9-1' + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 4 + .locals init (int32& V_0) + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$OutOptionalTests::outArg@8 + IL_0006: ldsflda int32 ''.$OutOptionalTests::outArg@8 + IL_000b: stloc.0 + IL_000c: ldloc.0 + IL_000d: ldc.i4.s 42 + IL_000f: stobj [runtime]System.Int32 + IL_0014: ldc.i4.0 + IL_0015: call int32 OutOptionalTests::get_outArg@8() + IL_001a: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, + !1) + IL_001f: stsfld class [runtime]System.Tuple`2 ''.$OutOptionalTests::patternInput@8 + IL_0024: ldc.i4.0 + IL_0025: stsfld int32 ''.$OutOptionalTests::'outArg@9-1' + IL_002a: ldsflda int32 ''.$OutOptionalTests::'outArg@9-1' + IL_002f: stloc.0 + IL_0030: ldloc.0 + IL_0031: ldc.i4.1 + IL_0032: stobj [runtime]System.Int32 + IL_0037: ldc.i4.0 + IL_0038: call int32 OutOptionalTests::'get_outArg@9-1'() + IL_003d: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, + !1) + IL_0042: stsfld class [runtime]System.Tuple`2 ''.$OutOptionalTests::'patternInput@9-1' + IL_0047: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs.RealInternalSignatureOn.il.bsl new file mode 100644 index 00000000000..6ef8ee296d3 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs.RealInternalSignatureOn.il.bsl @@ -0,0 +1,201 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed OutOptionalTests + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public Thing + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .method public static bool Do([out] int32& o, + [opt] int32 i) cil managed + { + .param [2] = int32(0x00000001) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: stobj [runtime]System.Int32 + IL_0007: ldarg.1 + IL_0008: ldc.i4.7 + IL_0009: ceq + IL_000b: ret + } + + } + + .field static assembly class [runtime]System.Tuple`2 patternInput@8 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 outArg@8 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly class [runtime]System.Tuple`2 'patternInput@9-1' + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 'outArg@9-1' + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method assembly specialname static class [runtime]System.Tuple`2 get_patternInput@8() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [runtime]System.Tuple`2 OutOptionalTests::patternInput@8 + IL_0005: ret + } + + .method assembly specialname static int32 get_outArg@8() cil managed + { + + .maxstack 8 + IL_0000: ldsfld int32 OutOptionalTests::outArg@8 + IL_0005: ret + } + + .method assembly specialname static void set_outArg@8(int32 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld int32 OutOptionalTests::outArg@8 + IL_0006: ret + } + + .method assembly specialname static class [runtime]System.Tuple`2 'get_patternInput@9-1'() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [runtime]System.Tuple`2 OutOptionalTests::'patternInput@9-1' + IL_0005: ret + } + + .method assembly specialname static int32 'get_outArg@9-1'() cil managed + { + + .maxstack 8 + IL_0000: ldsfld int32 OutOptionalTests::'outArg@9-1' + IL_0005: ret + } + + .method assembly specialname static void 'set_outArg@9-1'(int32 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld int32 OutOptionalTests::'outArg@9-1' + IL_0006: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$OutOptionalTests::init@ + IL_0006: ldsfld int32 ''.$OutOptionalTests::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 4 + .locals init (int32& V_0) + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 OutOptionalTests::outArg@8 + IL_0006: ldsflda int32 OutOptionalTests::outArg@8 + IL_000b: stloc.0 + IL_000c: ldloc.0 + IL_000d: ldc.i4.s 42 + IL_000f: stobj [runtime]System.Int32 + IL_0014: ldc.i4.0 + IL_0015: call int32 OutOptionalTests::get_outArg@8() + IL_001a: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, + !1) + IL_001f: stsfld class [runtime]System.Tuple`2 OutOptionalTests::patternInput@8 + IL_0024: ldc.i4.0 + IL_0025: stsfld int32 OutOptionalTests::'outArg@9-1' + IL_002a: ldsflda int32 OutOptionalTests::'outArg@9-1' + IL_002f: stloc.0 + IL_0030: ldloc.0 + IL_0031: ldc.i4.1 + IL_0032: stobj [runtime]System.Int32 + IL_0037: ldc.i4.0 + IL_0038: call int32 OutOptionalTests::'get_outArg@9-1'() + IL_003d: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, + !1) + IL_0042: stsfld class [runtime]System.Tuple`2 OutOptionalTests::'patternInput@9-1' + IL_0047: ret + } + + .property class [runtime]System.Tuple`2 + patternInput@8() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [runtime]System.Tuple`2 OutOptionalTests::get_patternInput@8() + } + .property int32 outArg@8() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void OutOptionalTests::set_outArg@8(int32) + .get int32 OutOptionalTests::get_outArg@8() + } + .property class [runtime]System.Tuple`2 + 'patternInput@9-1'() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .get class [runtime]System.Tuple`2 OutOptionalTests::'get_patternInput@9-1'() + } + .property int32 'outArg@9-1'() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void OutOptionalTests::'set_outArg@9-1'(int32) + .get int32 OutOptionalTests::'get_outArg@9-1'() + } +} + +.class private abstract auto ansi sealed ''.$OutOptionalTests + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void OutOptionalTests::staticInitialization@() + IL_0005: ret + } + +} + + + + + +