From fb01e0a4858b3f0b24ee115664b4b3255485f268 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sun, 13 Aug 2023 20:12:30 +0200 Subject: [PATCH 1/3] Moved Pattern Matching Test from FSharpQA to ComponentTests (#15758) * Moved Pattern Matching Test from FSharpQA to ComponentTests * update tests * update andPattern03 test * Remove old tests --- .../Conformance/PatternMatching/And/And.fs | 45 ++ .../PatternMatching/And/E_IdentBoundTwice.fs | 0 .../PatternMatching/And/andPattern01.fs | 0 .../PatternMatching/And/andPattern02.fs | 0 .../PatternMatching/And/andPattern03.fs | 2 +- .../PatternMatching/Array/Array.fs | 44 ++ .../PatternMatching/Array/TrailingSemi01.fs | 0 .../PatternMatching/Array/arrayMatch01.fs | 0 .../PatternMatching/Array/arrayMatch02.fs | 0 .../PatternMatching/Array/arrayMatch03.fs | 0 .../Conformance/PatternMatching/As/As.fs | 63 +++ .../PatternMatching/As/asPattern01.fs | 0 .../PatternMatching/As/asPattern02.fs | 0 .../PatternMatching/ConsList/ConsList.fs | 55 +++ .../ConsList/E_consOnNonList.fs | 0 .../ConsList/E_consPattern01.fs | 0 .../ConsList/OutsideMatch01.fs | 0 .../PatternMatching/ConsList/consPattern01.fs | 0 .../DynamicTypeTest/ArrayTypeTest01.fs | 0 .../DynamicTypeTest/DynamicTypeTest.fs | 150 ++++++ .../DynamicTypeTest/E_DynamTyTestVarType01.fs | 0 .../E_DynamicTestPrimType01.fs | 0 .../DynamicTypeTest/Regression01.fs | 0 .../DynamicTypeTest/Regression02.fs | 0 .../DynamicTypeTest/TwoAtOnce01.fs | 0 .../DynamicTypeTest/W_RedundantPattern01.fs | 0 .../W_TypeTestWillAlwaysHold01.fs | 0 .../DynamicTypeTest/dynTestSealedType01.fs | 0 .../DynamicTypeTest/dynamicTypeTest01.fs | 0 .../DynamicTypeTest/dynamicTypeTest02.fs | 0 .../DynamicTypeTest/dynamicTypeTest03.fs | 0 .../DynamicTypeTest/dynamicTypeTest04.fs | 0 .../DynamicTypeTest/genericType01.fs | 0 .../Expression/E_CounterExample01.fs | 0 .../PatternMatching/Expression/Expression.fs | 132 +++++ .../Expression/NoCounterExampleTryWith01.fs | 0 .../Expression/W_CounterExampleWithEnum01.fs | 0 .../Expression/W_CounterExampleWithEnum02.fs | 0 .../Expression/W_whenGuards01.fs | 0 .../PatternMatching/Expression/patterns01.fs | 0 .../PatternMatching/Expression/patterns02.fs | 0 .../Expression/whenGuards01.fs | 0 .../Expression/whenGuards02.fs | 0 .../Expression/whenGuardss01.fs | 0 .../Expression/whenGuardss02.fs | 0 .../Named/ActivePatternOutsideMatch01.fs | 0 .../Named/ActivePatternOutsideMatch02.fs | 0 .../Named/ActivePatternUnconstrained01.fs | 0 .../Named/AsHighOrderFunc01.fs | 0 .../Named/E_ActivePatternHasNoFields.fs | 0 .../Named/E_ActivePatternNotAFuncion.fs | 0 .../Named/E_ActivePatternUnconstrained01.fs | 0 .../Named/E_ActivePatterns01.fs | 0 .../Named/E_ActivePatterns02.fs | 0 .../PatternMatching/Named/E_Error_LetRec01.fs | 0 .../PatternMatching/Named/E_Error_LetRec02.fs | 0 .../PatternMatching/Named/E_Error_LetRec03.fs | 0 .../PatternMatching/Named/E_Error_LetRec04.fs | 0 .../Named/E_Error_NonParam01.fs | 0 .../Named/E_Error_NonParam02.fs | 0 .../Named/E_Error_NonParam03.fs | 0 .../Named/E_Error_NonParam04.fs | 0 .../PatternMatching/Named/E_Error_Param01.fs | 0 .../PatternMatching/Named/E_Error_Param02.fs | 0 .../PatternMatching/Named/E_Error_Param03.fs | 0 .../PatternMatching/Named/E_Error_Param04.fs | 0 .../Named/E_LargeActivePat01.fs | 0 .../Named/E_MulticasePartialNotAllowed01.fs | 0 .../Named/E_ParameterRestrictions01.fs | 0 .../Named/E_PatternMatchRegressions02.fs | 0 .../Named/MultiActivePatterns01.fs | 0 .../PatternMatching/Named/Named.fs | 456 ++++++++++++++++++ .../PatternMatching/Named/NamedLiteral01.fs | 0 .../PatternMatching/Named/NamedLiteral02.fs | 0 .../ParamertizedPartialActivePattern01.fs | 0 .../Named/PatternMatchRegressions01.fs | 2 +- .../Named/PatternMatchRegressions02.fs | 0 .../Named/RecursiveActivePats.fs | 0 .../PatternMatching/Named/activePatterns01.fs | 0 .../PatternMatching/Named/activePatterns02.fs | 0 .../PatternMatching/Named/activePatterns03.fs | 0 .../PatternMatching/Named/activePatterns05.fs | 0 .../PatternMatching/Named/activePatterns06.fs | 0 .../PatternMatching/Named/activePatterns07.fs | 0 .../PatternMatching/Named/activePatterns08.fs | 0 .../PatternMatching/Named/discUnion01.fs | 0 .../PatternMatching/Named/discUnion02.fs | 0 .../Null/E_notNullCompatible01.fs | 0 .../Conformance/PatternMatching/Null/Null.fs | 27 ++ .../PatternMatching/Null/matchNull01.fs | 0 .../Record/E_RecTypesNotMatch01.fs | 0 .../Record/E_RecordFieldNotDefined01.fs | 0 .../PatternMatching/Record/E_SyntaxError01.fs | 0 .../PatternMatching/Record/Record.fs | 83 ++++ .../Record/recordPatterns01.fs | 0 .../Record/recordPatterns02.fs | 0 .../Record/structRecordPatterns01.fs | 0 .../Record/structRecordPatterns02.fs | 0 .../Conformance/PatternMatching/Simple.fs | 129 ----- .../PatternMatching/Simple/CodeGenReg01.fs | 0 .../PatternMatching/Simple/E_SyntaxError01.fs | 0 .../Simple/E_ValueCapture01.fs | 0 .../Simple/E_constPattern01.fs | 0 .../Simple/E_namedLiberal01.fs | 0 .../Simple/MatchFailureExn01.fs | 0 .../PatternMatching/Simple/Simple.fs | 361 ++++++++++++++ .../PatternMatching/Simple/ValueCapture01.fs | 0 .../PatternMatching/Simple/ValueCapture02.fs | 0 .../Simple/W_BindCaptialIdent.fs | 0 .../PatternMatching/Simple/W_Incomplete01.fs | 0 .../PatternMatching/Simple/W_Incomplete02.fs | 0 .../Simple/simplePatterns01.fs | 0 .../Simple/simplePatterns02.fs | 0 .../Simple/simplePatterns03.fs | 0 .../Simple/simplePatterns04.fs | 0 .../Simple/simplePatterns05.fs | 0 .../Simple/simplePatterns06.fs | 0 .../Simple/simplePatterns07.fs | 0 .../Simple/simplePatterns08.fs | 0 .../Simple/simplePatterns09.fs | 0 .../Simple/simplePatterns10.fs | 0 .../Simple/simplePatterns11.fs | 0 .../Simple/simplePatterns12.fs | 0 .../Simple/simplePatterns13.fs | 0 .../Simple/simplePatterns14.fs | 0 .../Simple/simplePatterns15.fs | 0 .../Simple/simplePatterns16.fs | 0 .../Simple/simplePatterns17.fs | 0 .../Simple/simplePatterns18.fs | 0 .../Simple/simplePatterns19.fs | 0 .../Simple/simplePatterns20.fs | 0 .../SimpleConstant/DiffAssembly.fs | 2 +- .../SimpleConstant/E_NoRangeConst01.fs | 0 .../SimpleConstant/E_type_bigint.fs | 0 .../SimpleConstant/E_type_bignum40.fs | 0 .../SimpleConstant/FullyQualify01.fs | 0 .../SimpleConstant/MatchLiteral01.fs | 0 .../SimpleConstant/MatchNaN.fs | 0 .../SimpleConstant/SimpleConstant.fs | 295 +++++++++++ .../SimpleConstant/matchConst01.fs | 0 .../SimpleConstant/matchConst02.fs | 0 .../SimpleConstant/matchConst03.fs | 0 .../SimpleConstant/matchConst04.fs | 0 .../SimpleConstant/type_bigint.fs | 0 .../SimpleConstant/type_bool.fs | 0 .../SimpleConstant/type_byte.fs | 0 .../SimpleConstant/type_byteArr.fs | 0 .../SimpleConstant/type_char.fs | 0 .../SimpleConstant/type_double.fs | 0 .../SimpleConstant/type_float32.fs | 0 .../SimpleConstant/type_int.fs | 0 .../SimpleConstant/type_int16.fs | 0 .../SimpleConstant/type_int64.fs | 0 .../SimpleConstant/type_nativenint.fs | 0 .../SimpleConstant/type_sbyte.fs | 0 .../SimpleConstant/type_string.fs | 0 .../SimpleConstant/type_uint16.fs | 0 .../SimpleConstant/type_uint32.fs | 0 .../SimpleConstant/type_uint64.fs | 0 .../SimpleConstant/type_unativenint.fs | 0 .../SimpleConstant/type_unit.fs | 0 .../PatternMatching/Tuple/SimpleTuples01.fs | 0 .../PatternMatching/Tuple/Tuple.fs | 57 +++ .../Tuple/W_IncompleteMatches01.fs | 0 .../Tuple/W_RedundantPattern01.fs | 0 .../Tuple/W_RedundantPattern02.fs | 0 .../PatternMatching/Tuple/tuples01.fs | 0 .../TypeConstraint/E_typecontraint01.fs | 0 .../TypeConstraint/TypeConstraint.fs | 22 + .../Union/E_CapturesDiffVal01.fs | 0 .../Union/E_NotAllCaptureSameVal01.fs | 0 .../Union/E_UnionCapturesDiffType01.fs | 0 .../PatternMatching/Union/Union.fs | 84 ++++ .../PatternMatching/Union/unionPattern01.fs | 0 .../PatternMatching/Union/unionPattern02.fs | 0 .../PatternMatching/Union/unionPattern03.fs | 0 .../PatternMatching/Union/unionPattern04.fs | 0 .../PatternMatching/Wildcard/Wildcard.fs | 17 + .../Wildcard/wildCardPatterns01.fs | 0 .../FSharp.Compiler.ComponentTests.fsproj | 16 +- .../Conformance/PatternMatching/And/env.lst | 5 - .../Conformance/PatternMatching/Array/env.lst | 5 - .../Conformance/PatternMatching/As/env.lst | 2 - .../PatternMatching/ConsList/env.lst | 6 - .../PatternMatching/DynamicTypeTest/env.lst | 19 - .../PatternMatching/Expression/env.lst | 14 - .../Conformance/PatternMatching/Named/env.lst | 52 -- .../Conformance/PatternMatching/Null/env.lst | 3 - .../PatternMatching/Record/env.lst | 9 - .../PatternMatching/Simple/W_Incomplete01.fs | 109 ----- .../PatternMatching/Simple/W_Incomplete02.fs | 35 -- .../PatternMatching/Simple/env.lst | 35 -- .../PatternMatching/SimpleConstant/env.lst | 35 -- .../Conformance/PatternMatching/Tuple/env.lst | 5 - .../PatternMatching/TypeAnnotated/env.lst | 1 - .../PatternMatching/TypeConstraint/env.lst | 1 - .../Conformance/PatternMatching/Union/env.lst | 8 - .../PatternMatching/Wildcard/env.lst | 1 - tests/fsharpqa/Source/test.lst | 17 - 199 files changed, 1909 insertions(+), 495 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/And.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/And/E_IdentBoundTwice.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/And/andPattern01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/And/andPattern02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/And/andPattern03.fs (94%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/Array.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Array/TrailingSemi01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Array/arrayMatch01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Array/arrayMatch02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Array/arrayMatch03.fs (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/As.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/As/asPattern01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/As/asPattern02.fs (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/ConsList.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/ConsList/E_consOnNonList.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/ConsList/E_consPattern01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/ConsList/OutsideMatch01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/ConsList/consPattern01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/DynamicTypeTest/ArrayTypeTest01.fs (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/DynamicTypeTest.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/DynamicTypeTest/E_DynamTyTestVarType01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/DynamicTypeTest/E_DynamicTestPrimType01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/DynamicTypeTest/Regression01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/DynamicTypeTest/Regression02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/DynamicTypeTest/TwoAtOnce01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/DynamicTypeTest/W_RedundantPattern01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/DynamicTypeTest/W_TypeTestWillAlwaysHold01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/DynamicTypeTest/dynTestSealedType01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest03.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest04.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/DynamicTypeTest/genericType01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Expression/E_CounterExample01.fs (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/Expression.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Expression/NoCounterExampleTryWith01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Expression/W_CounterExampleWithEnum01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Expression/W_CounterExampleWithEnum02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Expression/W_whenGuards01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Expression/patterns01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Expression/patterns02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Expression/whenGuards01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Expression/whenGuards02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Expression/whenGuardss01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Expression/whenGuardss02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/ActivePatternOutsideMatch01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/ActivePatternOutsideMatch02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/ActivePatternUnconstrained01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/AsHighOrderFunc01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_ActivePatternHasNoFields.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_ActivePatternNotAFuncion.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_ActivePatternUnconstrained01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_ActivePatterns01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_ActivePatterns02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_Error_LetRec01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_Error_LetRec02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_Error_LetRec03.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_Error_LetRec04.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_Error_NonParam01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_Error_NonParam02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_Error_NonParam03.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_Error_NonParam04.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_Error_Param01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_Error_Param02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_Error_Param03.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_Error_Param04.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_LargeActivePat01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_MulticasePartialNotAllowed01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_ParameterRestrictions01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/E_PatternMatchRegressions02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/MultiActivePatterns01.fs (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/Named.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/NamedLiteral01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/NamedLiteral02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/ParamertizedPartialActivePattern01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/PatternMatchRegressions01.fs (99%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/PatternMatchRegressions02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/RecursiveActivePats.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/activePatterns01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/activePatterns02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/activePatterns03.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/activePatterns05.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/activePatterns06.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/activePatterns07.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/activePatterns08.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/discUnion01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Named/discUnion02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Null/E_notNullCompatible01.fs (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/Null.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Null/matchNull01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Record/E_RecTypesNotMatch01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Record/E_RecordFieldNotDefined01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Record/E_SyntaxError01.fs (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/Record.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Record/recordPatterns01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Record/recordPatterns02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Record/structRecordPatterns01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Record/structRecordPatterns02.fs (100%) delete mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/CodeGenReg01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/E_SyntaxError01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/E_ValueCapture01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/E_constPattern01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/E_namedLiberal01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/MatchFailureExn01.fs (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/Simple.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/ValueCapture01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/ValueCapture02.fs (100%) rename tests/FSharp.Compiler.ComponentTests/{resources/tests => }/Conformance/PatternMatching/Simple/W_BindCaptialIdent.fs (100%) rename tests/FSharp.Compiler.ComponentTests/{resources/tests => }/Conformance/PatternMatching/Simple/W_Incomplete01.fs (100%) rename tests/FSharp.Compiler.ComponentTests/{resources/tests => }/Conformance/PatternMatching/Simple/W_Incomplete02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns03.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns04.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns05.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns06.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns07.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns08.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns09.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns10.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns11.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns12.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns13.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns14.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns15.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns16.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns17.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns18.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns19.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Simple/simplePatterns20.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/DiffAssembly.fs (97%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/E_NoRangeConst01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/E_type_bigint.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/E_type_bignum40.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/FullyQualify01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/MatchLiteral01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/MatchNaN.fs (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/SimpleConstant.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/matchConst01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/matchConst02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/matchConst03.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/matchConst04.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/type_bigint.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/type_bool.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/type_byte.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/type_byteArr.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/type_char.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/type_double.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/type_float32.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/type_int.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/type_int16.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/type_int64.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/type_nativenint.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/type_sbyte.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/type_string.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/type_uint16.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/type_uint32.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/type_uint64.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/type_unativenint.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/SimpleConstant/type_unit.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Tuple/SimpleTuples01.fs (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/Tuple.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Tuple/W_IncompleteMatches01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Tuple/W_RedundantPattern01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Tuple/W_RedundantPattern02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Tuple/tuples01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/TypeConstraint/E_typecontraint01.fs (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/TypeConstraint.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Union/E_CapturesDiffVal01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Union/E_NotAllCaptureSameVal01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Union/E_UnionCapturesDiffType01.fs (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/Union.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Union/unionPattern01.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Union/unionPattern02.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Union/unionPattern03.fs (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Union/unionPattern04.fs (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Wildcard/Wildcard.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/PatternMatching/Wildcard/wildCardPatterns01.fs (100%) delete mode 100644 tests/fsharpqa/Source/Conformance/PatternMatching/And/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/PatternMatching/Array/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/PatternMatching/As/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/PatternMatching/ConsList/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/PatternMatching/Expression/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/PatternMatching/Named/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/PatternMatching/Null/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/PatternMatching/Record/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/PatternMatching/Simple/W_Incomplete01.fs delete mode 100644 tests/fsharpqa/Source/Conformance/PatternMatching/Simple/W_Incomplete02.fs delete mode 100644 tests/fsharpqa/Source/Conformance/PatternMatching/Simple/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/PatternMatching/Tuple/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/PatternMatching/TypeAnnotated/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/PatternMatching/TypeConstraint/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/PatternMatching/Union/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/PatternMatching/Wildcard/env.lst diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/And.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/And.fs new file mode 100644 index 00000000000..596de0187b1 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/And.fs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.PatternMatching + +open Xunit +open FSharp.Test +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 + |> 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 + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/And) + [] + let ``And - E_IdentBoundTwice_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 38, Line 9, Col 20, Line 9, Col 21, "'x' is bound twice in this pattern") \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/And/E_IdentBoundTwice.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/E_IdentBoundTwice.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/And/E_IdentBoundTwice.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/E_IdentBoundTwice.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/And/andPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/And/andPattern01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/And/andPattern02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/And/andPattern02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/And/andPattern03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern03.fs similarity index 94% rename from tests/fsharpqa/Source/Conformance/PatternMatching/And/andPattern03.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern03.fs index b7dcac145ca..2b9938c209b 100644 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/And/andPattern03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/And/andPattern03.fs @@ -3,7 +3,7 @@ open System -let (|ToInt|) x = +let (|ToInt|) (x: string) = let (parsed, result) = Int32.TryParse(x) if parsed then result else -1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/Array.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/Array.fs new file mode 100644 index 00000000000..5d686020f22 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/Array.fs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.PatternMatching + +open Xunit +open FSharp.Test +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 + |> 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 + |> 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 + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Array/TrailingSemi01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/TrailingSemi01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Array/TrailingSemi01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/TrailingSemi01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Array/arrayMatch01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/arrayMatch01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Array/arrayMatch01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/arrayMatch01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Array/arrayMatch02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/arrayMatch02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Array/arrayMatch02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/arrayMatch02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Array/arrayMatch03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/arrayMatch03.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Array/arrayMatch03.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Array/arrayMatch03.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/As.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/As.fs new file mode 100644 index 00000000000..81867fed44a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/As.fs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.PatternMatching + +open Xunit +open FSharp.Test +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 + |> 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 + |> asFsx + |> withOptions ["--test:ErrorRanges"] + |> compile + |> shouldSucceed + + [] + let ``As patterns``() = + Fsx """ + let (|Id|) = id + let a = [1..4] + match a with + | 1 | 1 as b::(Id 2 as c as c2)::[d as 3; Id e & Id _ as Id 4] as Id f when b = 1 && c = 2 && c2 = 2 && d = 3 && e = 4 && a = f -> () + | _ -> failwith "Match failed" + """ + |> asExe + |> withLangVersion60 + |> compileExeAndRun + |> shouldSucceed + + [] + [] + [] + [] + [] + [] + let ``Test type matching for subtypes and interfaces`` typ value = + Fsx $""" +open System +let classify (o: obj) = + match o with + | :? {typ} as d when d = Unchecked.defaultof<_> -> "default" + | :? IFormattable -> "formattable" + | _ -> "not a {typ}" + +let res = classify {value} +if res <> "formattable" then + failwith $"Unexpected result: {{res}}" + """ + |> asExe + |> compileAndRun + |> shouldSucceed \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/As/asPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/asPattern01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/As/asPattern01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/asPattern01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/As/asPattern02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/asPattern02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/As/asPattern02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/As/asPattern02.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/ConsList.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/ConsList.fs new file mode 100644 index 00000000000..2bae41654a8 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/ConsList.fs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.PatternMatching + +open Xunit +open FSharp.Test +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 + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 1, Line 4, Col 21, Line 4, Col 28, "This expression was expected to have type + 'int' +but here has type + ''a list' ") + ] + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/ConsList) + [] + let ``ConsList - E_consPattern01_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 1, Line 15, Col 22, Line 15, Col 24, "This expression was expected to have type + 'int' +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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 25, Line 6, Col 5, Line 6, Col 16, "Incomplete pattern matches on this expression. For example, the value '[_]' may indicate a case not covered by the pattern(s).") \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/ConsList/E_consOnNonList.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/E_consOnNonList.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/ConsList/E_consOnNonList.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/E_consOnNonList.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/ConsList/E_consPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/E_consPattern01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/ConsList/E_consPattern01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/E_consPattern01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/ConsList/OutsideMatch01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/OutsideMatch01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/ConsList/OutsideMatch01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/OutsideMatch01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/ConsList/consPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/consPattern01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/ConsList/consPattern01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/ConsList/consPattern01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/ArrayTypeTest01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/ArrayTypeTest01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/ArrayTypeTest01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/ArrayTypeTest01.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/DynamicTypeTest.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/DynamicTypeTest.fs new file mode 100644 index 00000000000..c2999b14ad9 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/DynamicTypeTest.fs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.PatternMatching + +open Xunit +open FSharp.Test +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 + |> 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 + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 26, Line 31, Col 7, Line 31, Col 22, "This rule will never be matched") + (Warning 26, Line 32, Col 7, Line 32, Col 22, "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 + |> 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 + |> 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 + |> 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 + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 8, Line 12, Col 7, Line 12, Col 13, "This runtime coercion or type test from type + 'a + 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 26, Line 12, Col 7, Line 12, Col 22, "This rule will never be matched") + (Warning 26, Line 18, Col 7, Line 18, Col 22, "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 + |> 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") \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/E_DynamTyTestVarType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamTyTestVarType01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/E_DynamTyTestVarType01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamTyTestVarType01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/E_DynamicTestPrimType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamicTestPrimType01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/E_DynamicTestPrimType01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/E_DynamicTestPrimType01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/Regression01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/Regression01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/Regression01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/Regression01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/Regression02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/Regression02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/Regression02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/Regression02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/TwoAtOnce01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/TwoAtOnce01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/TwoAtOnce01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/TwoAtOnce01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/W_RedundantPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_RedundantPattern01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/W_RedundantPattern01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_RedundantPattern01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/W_TypeTestWillAlwaysHold01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_TypeTestWillAlwaysHold01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/W_TypeTestWillAlwaysHold01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/W_TypeTestWillAlwaysHold01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/dynTestSealedType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynTestSealedType01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/dynTestSealedType01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynTestSealedType01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest03.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest03.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest03.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest04.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest04.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/dynamicTypeTest04.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/genericType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/genericType01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/genericType01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/DynamicTypeTest/genericType01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Expression/E_CounterExample01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/E_CounterExample01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Expression/E_CounterExample01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/E_CounterExample01.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/Expression.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/Expression.fs new file mode 100644 index 00000000000..2c82340ad76 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/Expression.fs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.PatternMatching + +open Xunit +open FSharp.Test +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 + |> 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 + |> 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 + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 25, Line 6, Col 24, Line 6, Col 25, "Incomplete pattern matches on this expression. For example, the value 'false' may indicate a case not covered by the pattern(s).") + (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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 25, Line 14, Col 10, Line 14, Col 18, "Incomplete pattern matches on this expression. For example, the value '\"a\"' may indicate a case not covered by the pattern(s).") + (Warning 25, Line 18, Col 10, Line 18, Col 18, "Incomplete pattern matches on this expression. For example, the value '0.0' may indicate a case not covered by the pattern(s).") + (Warning 25, Line 22, Col 10, Line 22, 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 26, Col 10, Line 26, Col 18, "Incomplete pattern matches on this expression. For example, the value '1y' 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 '[_;_;_]' 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 104, Line 14, Col 10, Line 14, Col 18, "Enums may take values outside known cases. For example, the value 'enum (2)' may indicate a case not covered by the pattern(s).") + (Warning 25, Line 18, Col 10, Line 18, 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 21, Col 10, Line 21, 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 24, Col 10, Line 24, 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 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> 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 + |> 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 + |> 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 + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Expression/NoCounterExampleTryWith01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/NoCounterExampleTryWith01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Expression/NoCounterExampleTryWith01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/NoCounterExampleTryWith01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Expression/W_CounterExampleWithEnum01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_CounterExampleWithEnum01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Expression/W_CounterExampleWithEnum01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_CounterExampleWithEnum01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Expression/W_CounterExampleWithEnum02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_CounterExampleWithEnum02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Expression/W_CounterExampleWithEnum02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_CounterExampleWithEnum02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Expression/W_whenGuards01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_whenGuards01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Expression/W_whenGuards01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/W_whenGuards01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Expression/patterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/patterns01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Expression/patterns01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/patterns01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Expression/patterns02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/patterns02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Expression/patterns02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/patterns02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Expression/whenGuards01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuards01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Expression/whenGuards01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuards01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Expression/whenGuards02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuards02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Expression/whenGuards02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuards02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Expression/whenGuardss01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuardss01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Expression/whenGuardss01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuardss01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Expression/whenGuardss02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuardss02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Expression/whenGuardss02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Expression/whenGuardss02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/ActivePatternOutsideMatch01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ActivePatternOutsideMatch01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/ActivePatternOutsideMatch01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ActivePatternOutsideMatch01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/ActivePatternOutsideMatch02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ActivePatternOutsideMatch02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/ActivePatternOutsideMatch02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ActivePatternOutsideMatch02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/ActivePatternUnconstrained01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ActivePatternUnconstrained01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/ActivePatternUnconstrained01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ActivePatternUnconstrained01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/AsHighOrderFunc01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/AsHighOrderFunc01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/AsHighOrderFunc01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/AsHighOrderFunc01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_ActivePatternHasNoFields.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternHasNoFields.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_ActivePatternHasNoFields.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternHasNoFields.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_ActivePatternNotAFuncion.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternNotAFuncion.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_ActivePatternNotAFuncion.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternNotAFuncion.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_ActivePatternUnconstrained01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternUnconstrained01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_ActivePatternUnconstrained01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatternUnconstrained01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_ActivePatterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_ActivePatterns01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_ActivePatterns02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_ActivePatterns02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ActivePatterns02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_LetRec01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_LetRec01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_LetRec02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_LetRec02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_LetRec03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec03.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_LetRec03.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec03.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_LetRec04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec04.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_LetRec04.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_LetRec04.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_NonParam01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_NonParam01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_NonParam02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_NonParam02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_NonParam03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam03.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_NonParam03.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam03.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_NonParam04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam04.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_NonParam04.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_NonParam04.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_Param01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_Param01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_Param02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_Param02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_Param03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param03.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_Param03.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param03.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_Param04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param04.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_Error_Param04.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_Error_Param04.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_LargeActivePat01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_LargeActivePat01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_LargeActivePat01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_LargeActivePat01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_MulticasePartialNotAllowed01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_MulticasePartialNotAllowed01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_MulticasePartialNotAllowed01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_MulticasePartialNotAllowed01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_ParameterRestrictions01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ParameterRestrictions01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_ParameterRestrictions01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_ParameterRestrictions01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_PatternMatchRegressions02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_PatternMatchRegressions02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/E_PatternMatchRegressions02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/E_PatternMatchRegressions02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/MultiActivePatterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/MultiActivePatterns01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/MultiActivePatterns01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/MultiActivePatterns01.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/Named.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/Named.fs new file mode 100644 index 00000000000..66157b9837a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/Named.fs @@ -0,0 +1,456 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.PatternMatching + +open Xunit +open FSharp.Test +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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) + [] + let ``Named - ActivePatternUnconstrained01_fs - --test:ErrorRanges`` compilation = + compilation + |> 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 + |> 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 + |> 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 + |> 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 + |> 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_ActivePatternNotAFuncion_fs - --test:ErrorRanges`` compilation = + compilation + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 623, Line 12, Col 7, Line 12, Col 15, "Active pattern case identifiers must begin with an uppercase letter") + (Error 623, Line 12, Col 16, Line 12, Col 24, "Active pattern case identifiers must begin with an uppercase letter") + (Error 623, Line 13, Col 7, Line 13, Col 13, "Active pattern case identifiers must begin with an uppercase letter") + (Error 623, Line 14, Col 10, Line 14, Col 17, "Active pattern case identifiers must begin with an uppercase letter") + (Error 623, Line 15, Col 7, Line 15, Col 13, "Active pattern case identifiers must begin with an uppercase letter") + (Error 624, Line 16, Col 7, Line 16, Col 14, "The '|' character is not permitted in active pattern case identifiers") + (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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3210, Line 6, Col 15, Line 6, Col 24, "A is an active pattern and cannot be treated as a discriminated union case with named fields.") + (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'.") + ] + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) + [] + let ``Named - E_ActivePatternUnconstrained01_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 25, Line 12, Col 18, Line 12, Col 19, "Incomplete pattern matches on this expression.") + (Warning 20, Line 14, Col 1, Line 14, Col 5, "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'.") + (Error 1210, Line 7, Col 6, Line 7, Col 16, "Active pattern '|A1|A2|A3|' 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 - E_Error_LetRec01_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 1, Line 5, Col 9, Line 5, Col 30, "This expression was expected to have 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 827, Line 4, Col 9, Line 4, Col 34, "This is not a valid name for an active pattern") + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) + [] + let ``Named - E_Error_LetRec03_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 827, Line 4, Col 10, Line 4, Col 43, "This is not a valid name for an active pattern") + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) + [] + let ``Named - E_Error_LetRec04_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 1, Line 4, Col 9, Line 4, Col 29, "This expression was expected to have 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 1, Line 4, Col 5, Line 4, Col 18, "This expression was expected to have 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 827, Line 4, Col 5, Line 4, Col 22, "This is not a valid name for an active pattern") + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) + [] + let ``Named - E_Error_NonParam03_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 827, Line 4, Col 5, Line 4, Col 30, "This is not a valid name for an active pattern") + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) + [] + let ``Named - E_Error_NonParam04_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 1, Line 4, Col 5, Line 4, Col 17, "This expression was expected to have 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 1, Line 4, Col 5, Line 4, Col 26, "This expression was expected to have 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 827, Line 4, Col 5, Line 4, Col 31, "This is not a valid name for an active pattern") + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) + [] + let ``Named - E_Error_Param03_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 827, Line 4, Col 5, Line 4, Col 38, "This is not a valid name for an active pattern") + ] + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) + [] + let ``Named - E_Error_Param04_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 1, Line 4, Col 5, Line 4, Col 25, "This expression was expected to have type + ''a option' +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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 265, Line 6, Col 53, Line 6, Col 56, "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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 827, Line 8, Col 5, Line 8, Col 64, "This is not a valid name for an active pattern") + (Error 39, Line 20, Col 7, Line 20, Col 15, "The pattern discriminator 'Sentence' is not defined.") + (Error 72, Line 20, Col 25, Line 20, Col 37, "Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.") + (Error 39, Line 21, Col 7, Line 21, Col 11, "The pattern discriminator 'Word' is not defined.") + (Error 72, Line 21, Col 20, Line 21, Col 31, "Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.") + (Warning 49, Line 22, Col 7, Line 22, Col 17, "Uppercase variable identifiers should not generally be used in patterns, and may indicate a missing open declaration or a misspelt pattern name.") + (Error 39, Line 23, Col 7, Line 23, Col 18, "The pattern discriminator 'Punctuation' is not defined.") + (Warning 26, Line 23, Col 7, Line 23, Col 26, "This rule will never be matched") + (Warning 26, Line 24, Col 7, Line 24, Col 40, "This rule will never be matched") + ] + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) + [] + let ``Named - E_ParameterRestrictions01_fs - --test:ErrorRanges`` compilation = + compilation + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 25, Line 23, Col 11, Line 23, Col 12, "Incomplete pattern matches on this expression.") + (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 + |> 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 + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Named) + [] + let ``Named - ParamertizedPartialActivePattern01_fs - --test:ErrorRanges`` compilation = + compilation + |> 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 + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/NamedLiteral01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/NamedLiteral01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/NamedLiteral01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/NamedLiteral01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/NamedLiteral02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/NamedLiteral02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/NamedLiteral02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/NamedLiteral02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/ParamertizedPartialActivePattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ParamertizedPartialActivePattern01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/ParamertizedPartialActivePattern01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/ParamertizedPartialActivePattern01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/PatternMatchRegressions01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/PatternMatchRegressions01.fs similarity index 99% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/PatternMatchRegressions01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/PatternMatchRegressions01.fs index 08c2cd44352..2d82c4c91f4 100644 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/PatternMatchRegressions01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/PatternMatchRegressions01.fs @@ -3,7 +3,7 @@ // FSB 1103, bad code generation for active patterns from fswebtools example -#light + #nowarn "57" open System diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/PatternMatchRegressions02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/PatternMatchRegressions02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/PatternMatchRegressions02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/PatternMatchRegressions02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/RecursiveActivePats.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/RecursiveActivePats.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/RecursiveActivePats.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/RecursiveActivePats.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/activePatterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/activePatterns01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/activePatterns02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/activePatterns02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/activePatterns03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns03.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/activePatterns03.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns03.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/activePatterns05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns05.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/activePatterns05.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns05.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/activePatterns06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns06.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/activePatterns06.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns06.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/activePatterns07.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns07.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/activePatterns07.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns07.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/activePatterns08.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns08.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/activePatterns08.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/activePatterns08.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/discUnion01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/discUnion01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/discUnion01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/discUnion01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/discUnion02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/discUnion02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Named/discUnion02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Named/discUnion02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Null/E_notNullCompatible01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/E_notNullCompatible01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Null/E_notNullCompatible01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/E_notNullCompatible01.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/Null.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/Null.fs new file mode 100644 index 00000000000..3faeae07f26 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/Null.fs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.PatternMatching + +open Xunit +open FSharp.Test +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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Null/matchNull01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/matchNull01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Null/matchNull01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Null/matchNull01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Record/E_RecTypesNotMatch01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecTypesNotMatch01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Record/E_RecTypesNotMatch01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecTypesNotMatch01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Record/E_RecordFieldNotDefined01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecordFieldNotDefined01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Record/E_RecordFieldNotDefined01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_RecordFieldNotDefined01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Record/E_SyntaxError01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_SyntaxError01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Record/E_SyntaxError01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/E_SyntaxError01.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/Record.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/Record.fs new file mode 100644 index 00000000000..a75f8910e5e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/Record.fs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.PatternMatching + +open Xunit +open FSharp.Test +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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> 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 + |> 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 + |> 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 + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Record/recordPatterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/recordPatterns01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Record/recordPatterns01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/recordPatterns01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Record/recordPatterns02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/recordPatterns02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Record/recordPatterns02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/recordPatterns02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Record/structRecordPatterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/structRecordPatterns01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Record/structRecordPatterns01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/structRecordPatterns01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Record/structRecordPatterns02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/structRecordPatterns02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Record/structRecordPatterns02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Record/structRecordPatterns02.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple.fs deleted file mode 100644 index 810fb2cc85b..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple.fs +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace Conformance.PatternMatching - -open Xunit -open FSharp.Test -open FSharp.Test.Compiler - -module Simple = - - // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - //Incomplete pattern matches on this expression. For example, the value 'Result \(_\)' may indicate a case not covered by the pattern\(s\) - [] - let ``Simple - W_Incomplete01_fs - --test:ErrorRanges`` compilation = - compilation - |> asFs - |> withOptions ["--test:ErrorRanges"] - |> typecheck - |> shouldFail - |> withWarningCode 0025 - |> withDiagnosticMessageMatches "Incomplete pattern matches on this expression. For example, the value 'Result \(_\)' may indicate a case not covered by the pattern\(s\)" - |> ignore - - // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - //This rule will never be matched - [] - let ``Simple - W_Incomplete02_fs - --test:ErrorRanges`` compilation = - compilation - |> asFsx - |> withOptions ["--test:ErrorRanges"] - |> compile - |> shouldFail - |> withWarningCode 0026 - |> withDiagnosticMessageMatches "This rule will never be matched" - |> ignore - - // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) - //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_BindCaptialIdent_fs - --test:ErrorRanges`` compilation = - compilation - |> asFsx - |> withOptions ["--test:ErrorRanges"] - |> compile - |> shouldFail - |> withWarningCode 0049 - |> withDiagnosticMessageMatches "Uppercase variable identifiers should not generally be used in patterns, and may indicate a missing open declaration or a misspelt pattern name" - |> ignore - - [] - let ``As patterns``() = - Fsx """ - let (|Id|) = id - let a = [1..4] - match a with - | 1 | 1 as b::(Id 2 as c as c2)::[d as 3; Id e & Id _ as Id 4] as Id f when b = 1 && c = 2 && c2 = 2 && d = 3 && e = 4 && a = f -> () - | _ -> failwith "Match failed" - """ - |> asExe - |> withLangVersion60 - |> compileExeAndRun - |> shouldSucceed - - - [] - [] - [] - [] - [] - [] - let ``Test type matching for subtypes and interfaces`` typ value = - Fsx $""" -open System -let classify (o: obj) = - match o with - | :? {typ} as d when d = Unchecked.defaultof<_> -> "default" - | :? IFormattable -> "formattable" - | _ -> "not a {typ}" - -let res = classify {value} -if res <> "formattable" then - failwith $"Unexpected result: {{res}}" - """ - |> asExe - |> compileAndRun - |> shouldSucceed - - - [] - let ``Enum incompleteness check should not hide an issue with outer DU pattern matching with nowarn:104 `` () = - Fsx """ -type E = A = 0 - -type Ex = - | ExA of int * E - | ExB of int - -let flub ex = - match ex with - | ExA(_, E.A) -> () - -flub (ExB 3) - """ - |> withNoWarn 104 - |> typecheck - |> shouldFail - |> withDiagnostics [Warning 25, Line 9, Col 11, Line 9, Col 13, "Incomplete pattern matches on this expression. For example, the value 'ExB (_)' may indicate a case not covered by the pattern(s)."] - - [] - let ``Enum incompleteness check in nested scenarios should report all warnings`` () = - Fsx """ -type E = - | FieldA = 1 - | FieldB = 2 - -type U = - | CaseA - | CaseB of E - -match CaseA with -| CaseB E.FieldA -> () -| CaseB E.FieldB -> () - """ - |> typecheck - |> shouldFail - |> withDiagnostics [ - Warning 104, Line 10, Col 7, Line 10, Col 12, "Enums may take values outside known cases. For example, the value 'CaseB (enum (0))' may indicate a case not covered by the pattern(s)." - Warning 25, Line 10, Col 7, Line 10, Col 12, "Incomplete pattern matches on this expression. For example, the value 'CaseA' may indicate a case not covered by the pattern(s)."] - \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/CodeGenReg01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/CodeGenReg01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/CodeGenReg01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/CodeGenReg01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/E_SyntaxError01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_SyntaxError01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/E_SyntaxError01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_SyntaxError01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/E_ValueCapture01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_ValueCapture01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/E_ValueCapture01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_ValueCapture01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/E_constPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_constPattern01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/E_constPattern01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_constPattern01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/E_namedLiberal01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_namedLiberal01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/E_namedLiberal01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/E_namedLiberal01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/MatchFailureExn01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/MatchFailureExn01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/MatchFailureExn01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/MatchFailureExn01.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/Simple.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/Simple.fs new file mode 100644 index 00000000000..7a6f40b4c6a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/Simple.fs @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.PatternMatching + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +module Simple = + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) + //Incomplete pattern matches on this expression. For example, the value 'Result \(_\)' may indicate a case not covered by the pattern\(s\) + [] + let ``Simple - W_Incomplete01_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> 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) + //This rule will never be matched + [] + let ``Simple - W_Incomplete02_fs - --test:ErrorRanges`` compilation = + compilation + |> asFsx + |> withOptions ["--test:ErrorRanges"] + |> compile + |> shouldFail + |> withDiagnostics [ + (Warning 25, Line 14, Col 15, Line 14, Col 16, "Incomplete pattern matches on this expression. For example, the value '0' may indicate a case not covered by the pattern(s).") + (Warning 25, Line 21, Col 31, Line 21, Col 39, "Incomplete pattern matches on this expression. For example, the value '0' may indicate a case not covered by the pattern(s).") + (Warning 26, Line 31, Col 11, Line 31, Col 18, "This rule will never be matched") + (Warning 26, Line 32, Col 11, Line 32, Col 19, "This rule will never be matched") + ] + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) + //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_BindCaptialIdent_fs - --test:ErrorRanges`` compilation = + compilation + |> asFsx + |> withOptions ["--test:ErrorRanges"] + |> compile + |> shouldFail + |> withDiagnostics [ + (Warning 49, Line 9, Col 16, Line 9, Col 19, "Uppercase variable identifiers should not generally be used in patterns, and may indicate a missing open declaration or a misspelt pattern name.") + (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.") + ] + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) + [] + let ``Simple - CodeGenReg01_fs - --test:ErrorRanges`` compilation = + compilation + |> 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 + |> 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 + |> 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 + |> 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 + |> asFsx + |> withOptions ["--test:ErrorRanges"] + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 39, Line 14, Col 8, Line 14, Col 14, "The value or constructor 'ident1' is not defined. Maybe you want one of the following: + int8 + int"); + (Error 39, Line 15, Col 8, Line 15, Col 14, "The value or constructor 'ident2' is not defined. Maybe you want one of the following: + int8 + int") + ] + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Simple) + [] + let ``Simple - MatchFailureExn01_fs - --test:ErrorRanges`` compilation = + compilation + |> asFsx + |> withOptions ["--test:ErrorRanges"] + |> compile + |> shouldFail + |> withDiagnostics [ + (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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> asFsx + |> withOptions ["--test:ErrorRanges"] + |> compile + |> shouldFail + |> withSingleDiagnostic (Warning 26, Line 10, Col 7, Line 10, Col 13, "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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> asFsx + |> withOptions ["--test:ErrorRanges";] + |> compile + |> shouldSucceed + + [] + let ``Enum incompleteness check should not hide an issue with outer DU pattern matching with nowarn:104 `` () = + Fsx """ +type E = A = 0 + +type Ex = + | ExA of int * E + | ExB of int + +let flub ex = + match ex with + | ExA(_, E.A) -> () + +flub (ExB 3) + """ + |> withNoWarn 104 + |> typecheck + |> shouldFail + |> withDiagnostics [Warning 25, Line 9, Col 11, Line 9, Col 13, "Incomplete pattern matches on this expression. For example, the value 'ExB (_)' may indicate a case not covered by the pattern(s)."] + + [] + let ``Enum incompleteness check in nested scenarios should report all warnings`` () = + Fsx """ +type E = + | FieldA = 1 + | FieldB = 2 + +type U = + | CaseA + | CaseB of E + +match CaseA with +| CaseB E.FieldA -> () +| CaseB E.FieldB -> () + """ + |> typecheck + |> shouldFail + |> withDiagnostics [ + Warning 104, Line 10, Col 7, Line 10, Col 12, "Enums may take values outside known cases. For example, the value 'CaseB (enum (0))' may indicate a case not covered by the pattern(s)." + Warning 25, Line 10, Col 7, Line 10, Col 12, "Incomplete pattern matches on this expression. For example, the value 'CaseA' may indicate a case not covered by the pattern(s)."] + \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/ValueCapture01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/ValueCapture01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/ValueCapture01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/ValueCapture01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/ValueCapture02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/ValueCapture02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/ValueCapture02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/ValueCapture02.fs diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/PatternMatching/Simple/W_BindCaptialIdent.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_BindCaptialIdent.fs similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/PatternMatching/Simple/W_BindCaptialIdent.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_BindCaptialIdent.fs diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/PatternMatching/Simple/W_Incomplete01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete01.fs similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/PatternMatching/Simple/W_Incomplete01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete01.fs diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/PatternMatching/Simple/W_Incomplete02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete02.fs similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/PatternMatching/Simple/W_Incomplete02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/W_Incomplete02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns03.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns03.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns03.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns04.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns04.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns04.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns05.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns05.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns05.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns06.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns06.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns06.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns07.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns07.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns07.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns07.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns08.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns08.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns08.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns08.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns09.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns09.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns09.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns09.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns10.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns10.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns10.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns10.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns11.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns11.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns11.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns11.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns12.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns12.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns12.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns12.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns13.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns13.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns13.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns13.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns14.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns14.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns14.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns14.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns15.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns15.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns15.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns15.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns16.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns16.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns16.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns16.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns17.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns17.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns17.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns17.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns18.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns18.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns18.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns18.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns19.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns19.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns19.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns19.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns20.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns20.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Simple/simplePatterns20.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Simple/simplePatterns20.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/DiffAssembly.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/DiffAssembly.fs similarity index 97% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/DiffAssembly.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/DiffAssembly.fs index ca425eeca92..ebc545abc33 100644 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/DiffAssembly.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/DiffAssembly.fs @@ -1,7 +1,7 @@ // #Conformance #PatternMatching #Constants #light -#light + // Verify pattern matching against constants defined in a different assembly. diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/E_NoRangeConst01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_NoRangeConst01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/E_NoRangeConst01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_NoRangeConst01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/E_type_bigint.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bigint.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/E_type_bigint.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bigint.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/E_type_bignum40.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bignum40.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/E_type_bignum40.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/E_type_bignum40.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/FullyQualify01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/FullyQualify01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/FullyQualify01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/FullyQualify01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/MatchLiteral01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchLiteral01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/MatchLiteral01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchLiteral01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/MatchNaN.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchNaN.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/MatchNaN.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/MatchNaN.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/SimpleConstant.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/SimpleConstant.fs new file mode 100644 index 00000000000..be57aa8eb9b --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/SimpleConstant.fs @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.PatternMatching + +open Xunit +open FSharp.Test +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 + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 720, Line 9, Col 7, Line 9, Col 9, "Non-primitive numeric literal constants cannot be used in pattern matches because they can be mapped to multiple different types through the use of a NumericLiteral module. Consider using replacing with a variable, and use 'when = ' at the end of the match clause.") + (Error 720, Line 10, Col 7, Line 10, Col 10, "Non-primitive numeric literal constants cannot be used in pattern matches because they can be mapped to multiple different types through the use of a NumericLiteral module. Consider using replacing with a variable, and use 'when = ' at the end of the match clause.") + ] + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) + [] + let ``SimpleConstant - E_type_bignum40_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 720, Line 10, Col 7, Line 10, Col 13, "Non-primitive numeric literal constants cannot be used in pattern matches because they can be mapped to multiple different types through the use of a NumericLiteral module. Consider using replacing with a variable, and use 'when = ' at the end of the match clause.") + (Error 720, Line 11, Col 7, Line 11, Col 9, "Non-primitive numeric literal constants cannot be used in pattern matches because they can be mapped to multiple different types through the use of a NumericLiteral module. Consider using replacing with a variable, and use 'when = ' at the end of the match clause.") + (Error 784, Line 14, Col 17, Line 14, Col 19, "This numeric literal requires that a module 'NumericLiteralN' defining functions FromZero, FromOne, FromInt32, FromInt64 and FromString be in scope") + ] + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) + [] + let ``SimpleConstant - FullyQualify01_fs - --test:ErrorRanges`` compilation = + compilation + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 3190, Line 13, Col 7, Line 13, Col 17, "Lowercase literal 'intLiteral' is being shadowed by a new pattern with the same name. Only uppercase and module-prefixed literals can be used as named patterns.") + (Warning 26, Line 14, Col 7, Line 14, Col 26, "This rule will never be matched") + (Warning 3190, Line 20, Col 7, Line 20, Col 17, "Lowercase literal 'strLiteral' is being shadowed by a new pattern with the same name. Only uppercase and module-prefixed literals can be used as named patterns.") + (Warning 26, Line 21, Col 7, Line 21, Col 26, "This rule will never be matched") + (Warning 3190, Line 27, Col 7, Line 27, Col 18, "Lowercase literal 'boolLiteral' is being shadowed by a new pattern with the same name. Only uppercase and module-prefixed literals can be used as named patterns.") + (Warning 26, Line 28, Col 7, Line 28, Col 27, "This rule will never be matched") + ] + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) + [] + let ``SimpleConstant - MatchNaN_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 25, Line 8, Col 11, Line 8, Col 16, "Incomplete pattern matches on this expression. For example, the value '``some-other-subtype``' may indicate a case not covered by the pattern(s).") + (Warning 26, Line 14, Col 7, Line 14, Col 57, "This rule will never be matched") + (Warning 26, Line 20, Col 7, Line 20, Col 57, "This rule will never be matched") + ] + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) + [] + let ``SimpleConstant - type_bigint_fs - --test:ErrorRanges`` compilation = + compilation + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 26, Line 10, Col 7, Line 10, Col 28, "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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> 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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) + [] + let ``SimpleConstant - type_nativenint_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) + [] + let ``SimpleConstant - type_sbyte_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) + [] + let ``SimpleConstant - type_string_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 26, Line 10, Col 7, Line 10, Col 26, "This rule will never be matched") + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) + [] + let ``SimpleConstant - type_uint16_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) + [] + let ``SimpleConstant - type_uint32_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) + [] + let ``SimpleConstant - type_uint64_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) + [] + let ``SimpleConstant - type_unativenint_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/SimpleConstant) + [] + let ``SimpleConstant - type_unit_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 26, Line 9, Col 7, Line 9, Col 17, "This rule will never be matched") \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/matchConst01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/matchConst01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/matchConst02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/matchConst02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/matchConst03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst03.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/matchConst03.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst03.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/matchConst04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst04.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/matchConst04.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/matchConst04.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_bigint.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_bigint.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_bigint.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_bigint.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_bool.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_bool.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_bool.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_bool.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_byte.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_byte.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_byte.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_byte.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_byteArr.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_byteArr.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_byteArr.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_byteArr.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_char.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_char.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_char.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_char.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_double.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_double.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_double.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_double.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_float32.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_float32.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_float32.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_float32.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_int.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_int.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_int.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_int.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_int16.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_int16.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_int16.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_int16.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_int64.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_int64.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_int64.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_int64.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_nativenint.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_nativenint.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_nativenint.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_nativenint.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_sbyte.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_sbyte.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_sbyte.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_sbyte.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_string.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_string.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_string.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_string.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_uint16.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_uint16.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_uint16.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_uint16.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_uint32.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_uint32.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_uint32.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_uint32.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_uint64.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_uint64.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_uint64.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_uint64.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_unativenint.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_unativenint.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_unativenint.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_unativenint.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_unit.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_unit.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/type_unit.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/SimpleConstant/type_unit.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Tuple/SimpleTuples01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/SimpleTuples01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Tuple/SimpleTuples01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/SimpleTuples01.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/Tuple.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/Tuple.fs new file mode 100644 index 00000000000..03398abebe6 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/Tuple.fs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.PatternMatching + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +module Tuple = + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Tuple) + [] + let ``Tuple - SimpleTuples01_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Tuple) + [] + let ``Tuple - tuples01_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Tuple) + [] + let ``Tuple - W_IncompleteMatches01_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 25, Line 8, Col 5, Line 8, Col 13, "Incomplete pattern matches on this expression. For example, the value '(0,1)' may indicate a case not covered by the pattern(s).") + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Tuple) + [] + let ``Tuple - W_RedundantPattern01_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 26, Line 11, Col 7, Line 12, Col 16, "This rule will never be matched") + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Tuple) + [] + let ``Tuple - W_RedundantPattern02_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 26, Line 12, Col 28, Line 12, Col 50, "This rule will never be matched") + \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Tuple/W_IncompleteMatches01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_IncompleteMatches01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Tuple/W_IncompleteMatches01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_IncompleteMatches01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Tuple/W_RedundantPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Tuple/W_RedundantPattern01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Tuple/W_RedundantPattern02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Tuple/W_RedundantPattern02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/W_RedundantPattern02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Tuple/tuples01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/tuples01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Tuple/tuples01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Tuple/tuples01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/TypeConstraint/E_typecontraint01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/E_typecontraint01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/TypeConstraint/E_typecontraint01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/E_typecontraint01.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/TypeConstraint.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/TypeConstraint.fs new file mode 100644 index 00000000000..d2d190f135d --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/TypeConstraint/TypeConstraint.fs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.PatternMatching + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +module TypeConstraint = + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/TypeConstraint) + [] + let ``TypeConstraint - E_typecontraint01_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 10, Line 21, Col 8, Line 21, Col 10, "Unexpected symbol ':>' in pattern. Expected ')' or other token.") + (Error 583, Line 21, Col 5, Line 21, Col 6, "Unmatched '('") + ] + \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Union/E_CapturesDiffVal01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_CapturesDiffVal01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Union/E_CapturesDiffVal01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_CapturesDiffVal01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Union/E_NotAllCaptureSameVal01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_NotAllCaptureSameVal01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Union/E_NotAllCaptureSameVal01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_NotAllCaptureSameVal01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Union/E_UnionCapturesDiffType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionCapturesDiffType01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Union/E_UnionCapturesDiffType01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/E_UnionCapturesDiffType01.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/Union.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/Union.fs new file mode 100644 index 00000000000..24f4fcbb8c9 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/Union.fs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.PatternMatching + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +module Union = + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Union) + [] + let ``Union - E_CapturesDiffVal01_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 18, Line 10, Col 7, Line 10, Col 28, "The two sides of this 'or' pattern bind different sets of variables") + (Error 18, Line 10, Col 7, Line 10, Col 40, "The two sides of this 'or' pattern bind different sets of variables") + ] + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Union) + [] + let ``Union - E_NotAllCaptureSameVal01_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 18, Line 10, Col 7, Line 10, Col 31, "The two sides of this 'or' pattern bind different sets of variables") + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Union) + [] + let ``Union - E_UnionCapturesDiffType01_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 1, Line 9, Col 10, Line 9, Col 11, "This expression was expected to have type + 'int' +but here has type + 'float' ") + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Union) + [] + let ``Union - unionPattern01_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Union) + [] + let ``Union - unionPattern02_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Union) + [] + let ``Union - unionPattern03_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 26, Line 12, Col 7, Line 12, Col 17, "This rule will never be matched") + (Warning 26, Line 21, Col 7, Line 21, Col 17, "This rule will never be matched") + ] + + // This test was automatically generated (moved from FSharpQA suite - Conformance/PatternMatching/Union) + [] + let ``Union - unionPattern04_fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Union/unionPattern01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Union/unionPattern01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Union/unionPattern02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Union/unionPattern02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Union/unionPattern03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern03.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Union/unionPattern03.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern03.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Union/unionPattern04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern04.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Union/unionPattern04.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Union/unionPattern04.fs diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Wildcard/Wildcard.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Wildcard/Wildcard.fs new file mode 100644 index 00000000000..2831e485b84 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Wildcard/Wildcard.fs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.PatternMatching + +open Xunit +open FSharp.Test +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 + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Wildcard/wildCardPatterns01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Wildcard/wildCardPatterns01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/PatternMatching/Wildcard/wildCardPatterns01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Wildcard/wildCardPatterns01.fs diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index af09e1f3879..20fd78fec08 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -87,7 +87,21 @@ - + + + + + + + + + + + + + + + diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/And/env.lst b/tests/fsharpqa/Source/Conformance/PatternMatching/And/env.lst deleted file mode 100644 index 7fdf3c254a1..00000000000 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/And/env.lst +++ /dev/null @@ -1,5 +0,0 @@ - SOURCE=andPattern01.fs # andPattern01.fs - SOURCE=andPattern02.fs # andPattern02.fs - SOURCE=andPattern03.fs # andPattern03.fs - - SOURCE=E_IdentBoundTwice.fs # E_IdentBoundTwice.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Array/env.lst b/tests/fsharpqa/Source/Conformance/PatternMatching/Array/env.lst deleted file mode 100644 index af0497ed76f..00000000000 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/Array/env.lst +++ /dev/null @@ -1,5 +0,0 @@ - SOURCE="arrayMatch01.fs" # ArrayMatch01 - SOURCE="arrayMatch02.fs" # ArrayMatch02 - SOURCE="arrayMatch03.fs" # ArrayMatch03 - - SOURCE="TrailingSemi01.fs" # TrailingSemi01 diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/As/env.lst b/tests/fsharpqa/Source/Conformance/PatternMatching/As/env.lst deleted file mode 100644 index 3e158fa9c48..00000000000 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/As/env.lst +++ /dev/null @@ -1,2 +0,0 @@ - SOURCE="asPattern01.fs" # AsPattern01 - SOURCE="asPattern02.fs" # AsPattern02 diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/ConsList/env.lst b/tests/fsharpqa/Source/Conformance/PatternMatching/ConsList/env.lst deleted file mode 100644 index a5920b6ae4f..00000000000 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/ConsList/env.lst +++ /dev/null @@ -1,6 +0,0 @@ - SOURCE=consPattern01.fs # consPattern01.fs - - SOURCE=E_consPattern01.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_consPattern01.fs - SOURCE=E_consOnNonList.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_consOnNonList.fs - - SOURCE=OutsideMatch01.fs # OutsideMatch01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/env.lst b/tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/env.lst deleted file mode 100644 index b16bb25ba59..00000000000 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/DynamicTypeTest/env.lst +++ /dev/null @@ -1,19 +0,0 @@ - SOURCE=dynamicTypeTest01.fs # dynamicTypeTest01.fs - SOURCE=dynamicTypeTest02.fs # dynamicTypeTest02.fs - SOURCE=dynamicTypeTest03.fs # dynamicTypeTest03.fs - SOURCE=dynamicTypeTest04.fs # dynamicTypeTest04.fs - - SOURCE=W_RedundantPattern01.fs # W_RedundantPattern01.fs - SOURCE=W_TypeTestWillAlwaysHold01.fs # W_TypeTestWillAlwaysHold01.fs - - SOURCE=ArrayTypeTest01.fs # ArrayTypeTest01.fs - - SOURCE=dynTestSealedType01.fs # dynTestSealedType01.fs - SOURCE=E_DynamicTestPrimType01.fs # E_DynamicTestPrimType01.fs - - SOURCE=genericType01.fs # genericType01.fs - - SOURCE=E_DynamTyTestVarType01.fs # E_DynamTyTestVarType01.fs - - SOURCE=Regression01.fs # Regression01.fs - SOURCE=TwoAtOnce01.fs # TwoAtOnce01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Expression/env.lst b/tests/fsharpqa/Source/Conformance/PatternMatching/Expression/env.lst deleted file mode 100644 index f47979b8793..00000000000 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/Expression/env.lst +++ /dev/null @@ -1,14 +0,0 @@ - SOURCE=E_CounterExample01.fs SCFLAGS="--test:ErrorRanges -a" # E_CounterExample01.fs - SOURCE=W_whenGuards01.fs SCFLAGS="--test:ErrorRanges -a" # W_whenGuards01.fs - - SOURCE=NoCounterExampleTryWith01.fs SCFLAGS="--test:ErrorRanges -a" # NoCounterExampleTryWith01.fs - SOURCE=W_CounterExampleWithEnum01.fs SCFLAGS="--test:ErrorRanges -a" # W_CounterExampleWithEnum01.fs - SOURCE=W_CounterExampleWithEnum02.fs SCFLAGS="--test:ErrorRanges -a" # W_CounterExampleWithEnum02.fs - - SOURCE=patterns01.fs # patterns01.fs - SOURCE=patterns02.fs # patterns02.fs - SOURCE=whenGuards01.fs # whenGuards01.fs - SOURCE=whenGuards02.fs # whenGuards02.fs - SOURCE=whenGuardss01.fs # whenGuardss01.fs - SOURCE=whenGuardss02.fs # whenGuardss02.fs - diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/env.lst b/tests/fsharpqa/Source/Conformance/PatternMatching/Named/env.lst deleted file mode 100644 index 7c5f143e98e..00000000000 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/Named/env.lst +++ /dev/null @@ -1,52 +0,0 @@ - SOURCE=E_Error_LetRec01.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_Error_LetRec01.fs - SOURCE=E_Error_LetRec02.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_Error_LetRec02.fs - SOURCE=E_Error_LetRec03.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_Error_LetRec03.fs - SOURCE=E_Error_LetRec04.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_Error_LetRec04.fs - SOURCE=E_Error_NonParam01.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_Error_NonParam01.fs - SOURCE=E_Error_NonParam02.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_Error_NonParam02.fs - SOURCE=E_Error_NonParam03.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_Error_NonParam03.fs - SOURCE=E_Error_NonParam04.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_Error_NonParam04.fs - SOURCE=E_Error_Param01.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_Error_Param01.fs - SOURCE=E_Error_Param02.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_Error_Param02.fs - SOURCE=E_Error_Param03.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_Error_Param03.fs - SOURCE=E_Error_Param04.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_Error_Param04.fs - - SOURCE=activePatterns01.fs # activePatterns01.fs - SOURCE=activePatterns02.fs # activePatterns02.fs - SOURCE=activePatterns03.fs # activePatterns03.fs - SOURCE=E_MulticasePartialNotAllowed01.fs SCFLAGS=--test:ErrorRanges # E_MulticasePartialNotAllowed01.fs - - SOURCE=activePatterns05.fs # activePatterns05.fs - SOURCE=activePatterns06.fs # activePatterns06.fs - SOURCE=activePatterns07.fs # activePatterns07.fs - SOURCE=activePatterns08.fs # activePatterns08.fs - -# SOURCE=AsHighOrderFunc01.fs # AsHighOrderFunc01.fs ### FAils on coreclr 2.1.500 - SOURCE=RecursiveActivePats.fs # RecursiveActivePats.fs - - SOURCE=E_ActivePatterns01.fs # E_ActivePatterns01.fs - SOURCE=E_ActivePatterns02.fs # E_ActivePatterns02.fs - SOURCE=E_ActivePatternHasNoFields.fs # E_ActivePatternHasNoFields.fs - SOURCE=E_ParameterRestrictions01.fs # E_ParameterRestrictions01.fs - - SOURCE=MultiActivePatterns01.fs # MultiActivePatterns01.fs - - SOURCE=ActivePatternOutsideMatch01.fs # ActivePatternOutsideMatch01.fs - SOURCE=ActivePatternOutsideMatch02.fs # ActivePatternOutsideMatch02.fs - - SOURCE=discUnion01.fs # discUnion01.fs - SOURCE=discUnion02.fs # discUnion02.fs - - SOURCE=NamedLiteral01.fs # NamedLiteral01.fs - SOURCE=NamedLiteral02.fs # NamedLiteral02.fs - - SOURCE=PatternMatchRegressions01.fs # PatternMatchRegressions01.fs - SOURCE=PatternMatchRegressions02.fs # PatternMatchRegressions02.fs - SOURCE=E_PatternMatchRegressions02.fs SCFLAGS=--test:ErrorRanges # E_PatternMatchRegressions02.fs - - SOURCE=ActivePatternUnconstrained01.fs # ActivePatternUnconstrained01.fs - SOURCE=E_ActivePatternUnconstrained01.fs SCFLAGS=--test:ErrorRanges # E_ActivePatternUnconstrained01.fs - SOURCE=E_ActivePatternNotAFuncion.fs SCFLAGS=--test:ErrorRanges # E_ActivePatternNotAFuncion.fs - - SOURCE=E_LargeActivePat01.fs # E_LargeActivePat01.fs - SOURCE=ParamertizedPartialActivePattern01.fs # ParamertizedPartialActivePattern01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Null/env.lst b/tests/fsharpqa/Source/Conformance/PatternMatching/Null/env.lst deleted file mode 100644 index 24c524049e1..00000000000 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/Null/env.lst +++ /dev/null @@ -1,3 +0,0 @@ - SOURCE=matchNull01.fs # MatchNull01.fs - - SOURCE=E_notNullCompatible01.fs # E_notNullCompatible01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Record/env.lst b/tests/fsharpqa/Source/Conformance/PatternMatching/Record/env.lst deleted file mode 100644 index 34a172bf716..00000000000 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/Record/env.lst +++ /dev/null @@ -1,9 +0,0 @@ - SOURCE=recordPatterns01.fs # recordPatterns01.fs - SOURCE=recordPatterns02.fs # recordPatterns02.fs - - SOURCE=structRecordPatterns01.fs # structRecordPatterns01.fs - SOURCE=structRecordPatterns02.fs # structRecordPatterns02.fs - - SOURCE=E_SyntaxError01.fs # E_SyntaxError01.fs - SOURCE=E_RecordFieldNotDefined01.fs # E_RecordFieldNotDefined01.fs - SOURCE=E_RecTypesNotMatch01.fs # E_RecTypesNotMatch01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/W_Incomplete01.fs b/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/W_Incomplete01.fs deleted file mode 100644 index 61db9b4e83c..00000000000 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/W_Incomplete01.fs +++ /dev/null @@ -1,109 +0,0 @@ -// #Regression #Conformance #PatternMatching -#light - -// Regression testcase for FSharp 1.0:2070 -// Warning on incomplete match - -//Incomplete pattern matches on this expression. For example, the value 'Result \(_\)' may indicate a case not covered by the pattern\(s\) - -module M = - - type Id = string - - type Field = { - Name:string; - mutable Type:Type; - mutable Parent:TypeDecl; - IsSpec:bool; - } - - and TypeDecl = - | Struct of Id * list - | Union of Id * list - | MathType of Id - - and Type = - | Void - | Integer - | Bool - | Ptr of Type - | Ref of TypeDecl - | Array of Type * int - | TypeIdT - | Tptr - | Map of Type * Type - - - type VarKind = - | Parameter - | Local - | Global - | QuantBound - - type Variable = { - Name:Id; - Type:Type; - Kind:VarKind; - } - - type Token = { - File: string; - Line:int; - Column:int; - Remarks:string; - } - - type ExprCommon = { - Token:Token; - Type:Type; - } - - type Function = { - Token:Token; - IsSpec:bool; - RetType:Type; - Name:Id; - Parameters:list; - Requires:list; - Ensures:list; - Invariants:list; - Writes:list; - Reads:list; - } - - and Expr = - | Ref of ExprCommon * Variable - | Prim of ExprCommon * string * list - | Call of ExprCommon * Function * list - | IntLiteral of ExprCommon * string - | BoolLiteral of ExprCommon * bool - | Deref of ExprCommon * Expr - | Addr of ExprCommon * Variable - | Dot of ExprCommon * Expr * Field // computes address of the field - | Index of ExprCommon * Expr * Expr // computes address of an array element - | Cast of ExprCommon * Expr // take the type from ExprCommon - | Result of ExprCommon - | VolatileRead of ExprCommon * Expr * Expr - | Old of ExprCommon * Expr - | Macro of ExprCommon * string * list - - type Expr with - member x.Common = - match x with - | Ref (e, _) - | Prim (e, _, _) - | Call (e, _, _) - | IntLiteral (e, _) - | BoolLiteral (e, _) - | Deref (e, _) - | Addr (e, _) - | Dot (e, _, _) - | Index (e, _, _) - | Cast (e, _) - //| Result (e) - | VolatileRead (e, _, _) - | Old (e, _) - | Macro (e, _, _) - -> e - -exit 0 diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/W_Incomplete02.fs b/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/W_Incomplete02.fs deleted file mode 100644 index 32fec0c6c5d..00000000000 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/W_Incomplete02.fs +++ /dev/null @@ -1,35 +0,0 @@ -// #Regression #Conformance #PatternMatching -// Regression test for FSharp1.0:4920 -// Title: Can't have a quotation with an incomplete pattern match -// Regression test for FSharp1.0:4904 -// Title: Incomplete pattern in quotation causes error. -// Descr: Make sure quotations compile (even with warning) when having incomplete pattern match inside - -//Incomplete pattern matches on this expression\. -//Incomplete pattern matches on this expression\. -//This rule will never be matched -//This rule will never be matched -let foo x = - <@@ - match x with - | 1 -> 1 - | 2 -> 2 - @@> - -let g = - <@ - let f ( int : int ) = function - | 1 -> 0 - | 2 -> 1 - f - @> - -let h = - <@@ - match 10 with - | x -> x - | 1 -> 20 - | 10 -> 10 - @@> - -exit 0 diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/env.lst b/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/env.lst deleted file mode 100644 index 7a8347b35e2..00000000000 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/Simple/env.lst +++ /dev/null @@ -1,35 +0,0 @@ - SOURCE=E_constPattern01.fs # E_constPattern01.fs - SOURCE=E_namedLiberal01.fs # E_namedLiberal01.fs - SOURCE=E_SyntaxError01.fs # E_SyntaxError01.fs - - - SOURCE=CodeGenReg01.fs # CodeGenReg01.fs - - SOURCE=MatchFailureExn01.fs # MatchFailureExn01.fs - - SOURCE=ValueCapture01.fs # ValueCapture01.fs - SOURCE=ValueCapture02.fs # ValueCapture02.fs - SOURCE=E_ValueCapture01.fs # E_ValueCapture01.fs - - SOURCE=simplePatterns01.fs # simplePatterns01.fs - SOURCE=simplePatterns02.fs # simplePatterns02.fs - SOURCE=simplePatterns03.fs # simplePatterns03.fs - SOURCE=simplePatterns04.fs # simplePatterns04.fs - SOURCE=simplePatterns05.fs # simplePatterns05.fs - SOURCE=simplePatterns06.fs # simplePatterns06.fs - SOURCE=simplePatterns07.fs # simplePatterns07.fs - SOURCE=simplePatterns08.fs # simplePatterns08.fs - SOURCE=simplePatterns09.fs # simplePatterns09.fs - SOURCE=simplePatterns10.fs # simplePatterns10.fs - SOURCE=simplePatterns11.fs # simplePatterns11.fs - SOURCE=simplePatterns12.fs # simplePatterns12.fs - SOURCE=simplePatterns13.fs # simplePatterns13.fs - SOURCE=simplePatterns14.fs # simplePatterns14.fs - SOURCE=simplePatterns15.fs # simplePatterns15.fs - SOURCE=simplePatterns16.fs # simplePatterns16.fs - SOURCE=simplePatterns17.fs # simplePatterns17.fs - SOURCE=simplePatterns18.fs # Pattern Match short Unicode literals - SOURCE=simplePatterns19.fs # Pattern Match long Unicode literals - SOURCE=simplePatterns20.fs # Pattern Match lshort Unicode literals in strings - - diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/env.lst b/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/env.lst deleted file mode 100644 index 1c60ead9d8b..00000000000 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/SimpleConstant/env.lst +++ /dev/null @@ -1,35 +0,0 @@ - SOURCE=matchConst01.fs # matchConst01.fs - SOURCE=matchConst02.fs # matchConst02.fs - SOURCE=matchConst03.fs # matchConst03.fs - SOURCE=matchConst04.fs # matchConst04.fs - - SOURCE=E_NoRangeConst01.fs # E_NoRangeConst01.fs - - SOURCE=DiffAssembly.fs # DiffAssembly.fs - SOURCE=MatchNaN.fs # MatchNaN.fs - - SOURCE=MatchLiteral01.fs # MatchLiteral01.fs - - SOURCE=FullyQualify01.fs # FullyQualify01.fs - - SOURCE=type_bigint.fs # type_bigint.fs - - SOURCE=E_type_bignum40.fs SCFLAGS="--test:ErrorRanges" # E_type_bignum40.fs - - SOURCE=type_bool.fs # type_bool.fs - SOURCE=type_byte.fs # type_byte.fs - SOURCE=type_byteArr.fs # type_byteArr.fs - SOURCE=type_char.fs # type_char.fs - SOURCE=type_double.fs # type_double.fs - SOURCE=type_float32.fs # type_float32.fs - SOURCE=type_int.fs # type_int.fs - SOURCE=type_int16.fs # type_int16.fs - SOURCE=type_int64.fs # type_int64.fs - SOURCE=type_nativenint.fs # type_nativenint.fs - SOURCE=type_sbyte.fs # type_sbyte.fs - SOURCE=type_string.fs # type_string.fs - SOURCE=type_uint16.fs # type_uint16.fs - SOURCE=type_uint32.fs # type_uint32.fs - SOURCE=type_uint64.fs # type_uint64.fs - SOURCE=type_unativenint.fs # type_unativenint.fs - SOURCE=type_unit.fs # type_unit.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Tuple/env.lst b/tests/fsharpqa/Source/Conformance/PatternMatching/Tuple/env.lst deleted file mode 100644 index 25f330533ba..00000000000 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/Tuple/env.lst +++ /dev/null @@ -1,5 +0,0 @@ - SOURCE=tuples01.fs # tuples01.fs - SOURCE=SimpleTuples01.fs # SimpleTuples01.fs - SOURCE=W_IncompleteMatches01.fs # W_IncompleteMatches01.fs - SOURCE=W_RedundantPattern01.fs # W_RedundantPattern01.fs - SOURCE=W_RedundantPattern02.fs # W_RedundantPattern02.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/TypeAnnotated/env.lst b/tests/fsharpqa/Source/Conformance/PatternMatching/TypeAnnotated/env.lst deleted file mode 100644 index 1bb8bf6d7fd..00000000000 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/TypeAnnotated/env.lst +++ /dev/null @@ -1 +0,0 @@ -# empty diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/TypeConstraint/env.lst b/tests/fsharpqa/Source/Conformance/PatternMatching/TypeConstraint/env.lst deleted file mode 100644 index abf80037e6a..00000000000 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/TypeConstraint/env.lst +++ /dev/null @@ -1 +0,0 @@ - SOURCE=E_typecontraint01.fs SCFLAGS="-a --test:ErrorRanges" # E_typecontraint01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Union/env.lst b/tests/fsharpqa/Source/Conformance/PatternMatching/Union/env.lst deleted file mode 100644 index 0c296584ea2..00000000000 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/Union/env.lst +++ /dev/null @@ -1,8 +0,0 @@ - SOURCE=unionPattern01.fs # unionPattern01.fs - SOURCE=unionPattern02.fs # unionPattern02.fs - SOURCE=unionPattern03.fs # unionPattern03.fs - SOURCE=unionPattern04.fs # unionPattern04.fs - - SOURCE=E_NotAllCaptureSameVal01.fs # E_NotAllCaptureSameVal01.fs -xxx SOURCE=E_UnionCapturesDiffType01.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_UnionCapturesDiffType01.fs - SOURCE=E_CapturesDiffVal01.fs # E_CapturesDiffVal01.fs diff --git a/tests/fsharpqa/Source/Conformance/PatternMatching/Wildcard/env.lst b/tests/fsharpqa/Source/Conformance/PatternMatching/Wildcard/env.lst deleted file mode 100644 index 7b32de49ca7..00000000000 --- a/tests/fsharpqa/Source/Conformance/PatternMatching/Wildcard/env.lst +++ /dev/null @@ -1 +0,0 @@ - SOURCE=wildCardPatterns01.fs # wildCardPatterns01.fs diff --git a/tests/fsharpqa/Source/test.lst b/tests/fsharpqa/Source/test.lst index 7d700adc076..31b787ef41e 100644 --- a/tests/fsharpqa/Source/test.lst +++ b/tests/fsharpqa/Source/test.lst @@ -127,23 +127,6 @@ Conformance07 Conformance\ObjectOrientedTypeDefinitions\TypeExtensions\intrins Conformance07 Conformance\ObjectOrientedTypeDefinitions\TypeExtensions\optional Conformance07 Conformance\ObjectOrientedTypeDefinitions\TypeKindInference -Conformance07 Conformance\PatternMatching\And -Conformance07 Conformance\PatternMatching\Array -Conformance07 Conformance\PatternMatching\As -Conformance07 Conformance\PatternMatching\ConsList -Conformance07 Conformance\PatternMatching\DynamicTypeTest -Conformance07 Conformance\PatternMatching\Expression -Conformance07 Conformance\PatternMatching\Named -Conformance07 Conformance\PatternMatching\Null -Conformance07 Conformance\PatternMatching\Record -Conformance07 Conformance\PatternMatching\Simple -Conformance07 Conformance\PatternMatching\SimpleConstant -Conformance08 Conformance\PatternMatching\Tuple -Conformance08 Conformance\PatternMatching\TypeAnnotated -Conformance08 Conformance\PatternMatching\TypeConstraint -Conformance08 Conformance\PatternMatching\Union -Conformance08 Conformance\PatternMatching\Wildcard - Conformance08 Conformance\Signatures\SignatureConformance Conformance08 Conformance\Signatures\SignatureTypes From db68a6cc80fbb0bf33280c34a9b37f2fe4bf2db1 Mon Sep 17 00:00:00 2001 From: Petr Date: Mon, 14 Aug 2023 14:25:40 +0200 Subject: [PATCH 2/3] Fixing signature-related code fixes (#15766) * Fixing signature-related code fixes * fixing merge issues * Removing unused code --- FSharp.Editor.sln | 8 ++ .../ProjectGeneration.fs | 9 ++- .../FSharp.Editor/CodeFixes/CodeFixHelpers.fs | 19 ----- .../CodeFixes/RenameParamToMatchSignature.fs | 80 ++++++++----------- .../CodeFixes/CodeFixTestFramework.fs | 3 + .../RenameParamToMatchSignatureTests.fs | 42 ++++++++++ .../FSharp.Editor.Tests.fsproj | 1 + .../Helpers/RoslynHelpers.fs | 28 ++++--- 8 files changed, 112 insertions(+), 78 deletions(-) create mode 100644 vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RenameParamToMatchSignatureTests.fs diff --git a/FSharp.Editor.sln b/FSharp.Editor.sln index 3b03857a6ca..1223a07c99a 100644 --- a/FSharp.Editor.sln +++ b/FSharp.Editor.sln @@ -19,6 +19,8 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.VS.FSI", "vsintegrat EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FSharp.Editor.IntegrationTests", "vsintegration\tests\FSharp.Editor.IntegrationTests\FSharp.Editor.IntegrationTests.csproj", "{42BE0F2F-BC45-437B-851D-E88A83201339}" EndProject +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Test.Utilities", "tests\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj", "{B7148170-93C5-4F2F-B31D-85316D3248CF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -73,6 +75,12 @@ Global {42BE0F2F-BC45-437B-851D-E88A83201339}.Proto|Any CPU.Build.0 = Debug|Any CPU {42BE0F2F-BC45-437B-851D-E88A83201339}.Release|Any CPU.ActiveCfg = Release|Any CPU {42BE0F2F-BC45-437B-851D-E88A83201339}.Release|Any CPU.Build.0 = Release|Any CPU + {B7148170-93C5-4F2F-B31D-85316D3248CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B7148170-93C5-4F2F-B31D-85316D3248CF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B7148170-93C5-4F2F-B31D-85316D3248CF}.Proto|Any CPU.ActiveCfg = Debug|Any CPU + {B7148170-93C5-4F2F-B31D-85316D3248CF}.Proto|Any CPU.Build.0 = Debug|Any CPU + {B7148170-93C5-4F2F-B31D-85316D3248CF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B7148170-93C5-4F2F-B31D-85316D3248CF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/tests/FSharp.Test.Utilities/ProjectGeneration.fs b/tests/FSharp.Test.Utilities/ProjectGeneration.fs index 0b4ea1e7aaa..1d4c882a954 100644 --- a/tests/FSharp.Test.Utilities/ProjectGeneration.fs +++ b/tests/FSharp.Test.Utilities/ProjectGeneration.fs @@ -231,7 +231,9 @@ type SyntheticProject = OtherOptions: string list AutoAddModules: bool NugetReferences: Reference list - FrameworkReferences: Reference list } + FrameworkReferences: Reference list + /// If set to true this project won't cause an exception if there are errors in the initial check + SkipInitialCheck: bool } static member Create(?name: string) = let name = defaultArg name $"TestProject_{Guid.NewGuid().ToString()[..7]}" @@ -245,7 +247,8 @@ type SyntheticProject = OtherOptions = [] AutoAddModules = true NugetReferences = [] - FrameworkReferences = [] } + FrameworkReferences = [] + SkipInitialCheck = false } static member Create([] sourceFiles: SyntheticSourceFile[]) = { SyntheticProject.Create() with SourceFiles = sourceFiles |> List.ofArray } @@ -754,7 +757,7 @@ let SaveAndCheckProject project checker = let! results = checker.ParseAndCheckProject(options) - if not (Array.isEmpty results.Diagnostics) then + if not (Array.isEmpty results.Diagnostics || project.SkipInitialCheck) then failwith $"Project {project.Name} failed initial check: \n%A{results.Diagnostics}" let! signatures = diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/CodeFixHelpers.fs b/vsintegration/src/FSharp.Editor/CodeFixes/CodeFixHelpers.fs index 6ea37164caa..dec879fd7d8 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/CodeFixHelpers.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/CodeFixHelpers.fs @@ -4,7 +4,6 @@ namespace Microsoft.VisualStudio.FSharp.Editor open System open System.Threading -open System.Threading.Tasks open System.Collections.Immutable open System.Diagnostics @@ -73,24 +72,6 @@ module internal CodeFixHelpers = TelemetryReporter.ReportSingleEvent(TelemetryEvents.CodefixActivated, props) - let createFixAllProvider name getChanges = - FixAllProvider.Create(fun fixAllCtx doc allDiagnostics -> - backgroundTask { - let sw = Stopwatch.StartNew() - let! (changes: seq) = getChanges (doc, allDiagnostics, fixAllCtx.CancellationToken) - let! text = doc.GetTextAsync(fixAllCtx.CancellationToken) - let doc = doc.WithText(text.WithChanges(changes)) - - do - reportCodeFixTelemetry - allDiagnostics - doc - name - [| "scope", fixAllCtx.Scope.ToString(); "elapsedMs", sw.ElapsedMilliseconds |] - - return doc - }) - let createTextChangeCodeFix (name: string, title: string, context: CodeFixContext, changes: TextChange seq) = CodeAction.Create( title, diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/RenameParamToMatchSignature.fs b/vsintegration/src/FSharp.Editor/CodeFixes/RenameParamToMatchSignature.fs index 1dfc34e62bb..a6d8ca2867e 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/RenameParamToMatchSignature.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/RenameParamToMatchSignature.fs @@ -3,8 +3,6 @@ namespace Microsoft.VisualStudio.FSharp.Editor open System.Composition -open System.Threading -open System.Threading.Tasks open System.Collections.Immutable open System.Text.RegularExpressions @@ -13,11 +11,13 @@ open Microsoft.CodeAnalysis.Text open Microsoft.CodeAnalysis.CodeFixes open Microsoft.VisualStudio.FSharp.Editor.SymbolHelpers +open FSharp.Compiler.Diagnostics open FSharp.Compiler.Tokenization.FSharpKeywords +open CancellableTasks + [] type internal RenameParamToMatchSignatureCodeFixProvider [] () = - inherit CodeFixProvider() let getSuggestion (d: Diagnostic) = @@ -28,53 +28,41 @@ type internal RenameParamToMatchSignatureCodeFixProvider [ else ValueNone - override _.FixableDiagnosticIds = ImmutableArray.Create("FS3218") + override _.FixableDiagnosticIds = ImmutableArray.Create "FS3218" + + override this.RegisterCodeFixesAsync context = context.RegisterFsharpFix this - member this.GetChanges(document: Document, diagnostics: ImmutableArray, ct: CancellationToken) = - backgroundTask { - let! sourceText = document.GetTextAsync(ct) + override this.GetFixAllProvider() = this.RegisterFsharpFixAll() - let! changes = - seq { - for d in diagnostics do - let suggestionOpt = getSuggestion d + interface IFSharpCodeFixProvider with + member _.GetCodeFixIfAppliesAsync context = + cancellableTask { + let! sourceText = context.GetSourceTextAsync() - match suggestionOpt with - | ValueSome suggestion -> - let replacement = NormalizeIdentifierBackticks suggestion + let suggestionOpt = getSuggestion context.Diagnostics[0] - async { - let! symbolUses = getSymbolUsesOfSymbolAtLocationInDocument (document, d.Location.SourceSpan.Start) - let symbolUses = symbolUses |> Option.defaultValue [||] + match suggestionOpt with + | ValueSome suggestion -> + let replacement = NormalizeIdentifierBackticks suggestion - return - [| - for symbolUse in symbolUses do - match RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, symbolUse.Range) with - | None -> () - | Some span -> - let textSpan = Tokenizer.fixupSpan (sourceText, span) - yield TextChange(textSpan, replacement) - |] + let! symbolUses = getSymbolUsesOfSymbolAtLocationInDocument (context.Document, context.Span.Start) + let symbolUses = symbolUses |> Option.defaultValue [||] + let changes = + [ + for symbolUse in symbolUses do + let span = RoslynHelpers.FSharpRangeToTextSpan(sourceText, symbolUse.Range) + let textSpan = Tokenizer.fixupSpan (sourceText, span) + yield TextChange(textSpan, replacement) + ] + + return + ValueSome + { + Name = CodeFix.FSharpRenameParamToMatchSignature + Message = CompilerDiagnostics.GetErrorMessage(FSharpDiagnosticKind.ReplaceWithSuggestion suggestion) + Changes = changes } - | ValueNone -> () - } - |> Async.Parallel - - return (changes |> Seq.concat) - } - - override this.RegisterCodeFixesAsync ctx : Task = - backgroundTask { - let title = ctx.Diagnostics |> Seq.head |> getSuggestion - - match title with - | ValueSome title -> - let! changes = this.GetChanges(ctx.Document, ctx.Diagnostics, ctx.CancellationToken) - ctx.RegisterFsharpFix(CodeFix.FSharpRenameParamToMatchSignature, title, changes) - | ValueNone -> () - } - - override this.GetFixAllProvider() = - CodeFixHelpers.createFixAllProvider CodeFix.FSharpRenameParamToMatchSignature this.GetChanges + + | ValueNone -> return ValueNone + } diff --git a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/CodeFixTestFramework.fs b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/CodeFixTestFramework.fs index 8f7bbffe642..2098dc76958 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/CodeFixTestFramework.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/CodeFixTestFramework.fs @@ -20,6 +20,7 @@ type TestCodeFix = { Message: string; FixedCode: string } type Mode = | Auto | WithOption of CustomProjectOption: string + | WithSignature of FsiCode: string | Manual of Squiggly: string * Diagnostic: string let inline toOption o = @@ -41,6 +42,7 @@ let getDocument code mode = match mode with | Auto -> RoslynTestHelpers.GetFsDocument code | WithOption option -> RoslynTestHelpers.GetFsDocument(code, option) + | WithSignature fsiCode -> RoslynTestHelpers.GetFsiAndFsDocuments fsiCode code |> Seq.last | Manual _ -> RoslynTestHelpers.GetFsDocument code let getRelevantDiagnostics (document: Document) = @@ -64,6 +66,7 @@ let createTestCodeFixContext (code: string) document (mode: Mode) diagnosticIds getRelevantDiagnostics document |> Array.filter (fun d -> diagnosticIds |> Seq.contains d.ErrorNumberText) | WithOption _ -> getRelevantDiagnostics document + | WithSignature _ -> getRelevantDiagnostics document | Manual (squiggly, diagnostic) -> let spanStart = code.IndexOf squiggly let span = TextSpan(spanStart, squiggly.Length) diff --git a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RenameParamToMatchSignatureTests.fs b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RenameParamToMatchSignatureTests.fs new file mode 100644 index 00000000000..5b606b2393f --- /dev/null +++ b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RenameParamToMatchSignatureTests.fs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +module FSharp.Editor.Tests.CodeFixes.RenameParamToMatchSignatureTests + +open Microsoft.VisualStudio.FSharp.Editor +open Xunit + +open CodeFixTestFramework + +let private codeFix = RenameParamToMatchSignatureCodeFixProvider() + +[] +let ``Fixes FS3218`` () = + let fsCode = + """ +module Library + +let id y = y +""" + + let fsiCode = + """ +module Library + +val id: x: 'a -> 'a +""" + + let expected = + Some + { + Message = "Replace with 'x'" + FixedCode = + """ +module Library + +let id x = x +""" + } + + let actual = codeFix |> tryFix fsCode (WithSignature fsiCode) + + Assert.Equal(expected, actual) diff --git a/vsintegration/tests/FSharp.Editor.Tests/FSharp.Editor.Tests.fsproj b/vsintegration/tests/FSharp.Editor.Tests/FSharp.Editor.Tests.fsproj index 439045694d8..65851ab5b71 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/FSharp.Editor.Tests.fsproj +++ b/vsintegration/tests/FSharp.Editor.Tests/FSharp.Editor.Tests.fsproj @@ -58,6 +58,7 @@ + diff --git a/vsintegration/tests/FSharp.Editor.Tests/Helpers/RoslynHelpers.fs b/vsintegration/tests/FSharp.Editor.Tests/Helpers/RoslynHelpers.fs index 36e70eae0d9..ee069431c98 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/Helpers/RoslynHelpers.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/Helpers/RoslynHelpers.fs @@ -358,17 +358,25 @@ type RoslynTestHelpers private () = |> RoslynTestHelpers.GetSingleDocument static member GetFsiAndFsDocuments (fsiCode: string) (fsCode: string) = - let projectId = ProjectId.CreateNewId() - let projFilePath = "C:\\test.fsproj" - - let fsiDocInfo = - RoslynTestHelpers.CreateDocumentInfo projectId "C:\\test.fsi" fsiCode - - let fsDocInfo = RoslynTestHelpers.CreateDocumentInfo projectId "C:\\test.fs" fsCode - let projInfo = - RoslynTestHelpers.CreateProjectInfo projectId projFilePath [ fsiDocInfo; fsDocInfo ] + { SyntheticProject.Create( + { sourceFile "test" [] with + SignatureFile = Custom fsiCode + Source = fsCode + } + ) with + + AutoAddModules = false + SkipInitialCheck = true + OtherOptions = + [ + "--targetprofile:netcore" // without this lib some symbols are not loaded + "--nowarn:3384" // The .NET SDK for this script could not be determined + ] + } - let solution = RoslynTestHelpers.CreateSolution [ projInfo ] + let solution, _ = RoslynTestHelpers.CreateSolution projInfo let project = solution.Projects |> Seq.exactlyOne + project.Documents + |> Seq.sortWith (fun d1 _ -> if d1.IsFSharpSignatureFile then -1 else 1) From abc3abb9834c63c6ab93959242f18914dd09bddc Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Mon, 14 Aug 2023 16:24:14 +0200 Subject: [PATCH 3/3] Fix loading legacy projects (#15796) --- .../src/FSharp.Editor/LanguageService/LanguageService.fs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index 21c694f060e..94139505662 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -401,6 +401,10 @@ type internal FSharpPackage() as this = SingleFileWorkspaceMap(FSharpMiscellaneousFileService(workspace, miscFilesWorkspace, projectContextFactory), rdt) |> ignore + do + LegacyProjectWorkspaceMap(solution, optionsManager, projectContextFactory) + |> ignore + } |> CancellableTask.startAsTask cancellationToken