From deb72d2deb652673bfcb7a9495d1568a3731fa61 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Tue, 6 May 2025 14:10:36 -0700 Subject: [PATCH] Clean up Conformance UnitsOfMeasure --- .../CompilerOptions/fsc/checked/checked.fs | 2 +- .../Conformance/UnitsOfMeasure/Basic.fs | 64 ----- .../Conformance/UnitsOfMeasure/Basic/Basic.fs | 56 +++++ .../UnitsOfMeasure/Basic/Calculus.fsx} | 1 + .../UnitsOfMeasure/Basic/DynamicTypeTest.fsx} | 0 .../UnitsOfMeasure/Basic/E_MassForce.fsx} | 0 .../UnitsOfMeasure/Basic/Ints01.fsx} | 0 .../UnitsOfMeasure/Basic/Mars.fsx} | 0 .../UnitsOfMeasure/Basic/MassForce.fsx} | 0 .../UnitsOfMeasure/Basic/Misc01.fsx} | 0 .../UnitsOfMeasure/Basic/Misc02.fsx} | 2 +- .../UnitsOfMeasure/Basic/Misc03.fsx} | 0 .../UnitsOfMeasure/Basic/Misc04.fsx} | 0 .../UnitsOfMeasure/Basic/OnDecimals01.fsx} | 0 .../Basic/Quotation04_hidden.fsx} | 0 .../Basic/RationalExponents01.fsx} | 0 .../UnitsOfMeasure/Basic/SI.fsx} | 0 .../UnitsOfMeasure/Basic/Stats.fsx} | 0 .../UnitsOfMeasure/Bounds/Bounds.fs | 36 +++ .../UnitsOfMeasure/Bounds/infinity_01.fsx} | 0 .../UnitsOfMeasure/Bounds/nan_01.fsx} | 1 - .../UnitsOfMeasure/Constants/Constants.fs | 42 ++++ .../Constants/E_UnsupportedTypes01.fsx} | 0 .../Constants/SpecialSyntax_.fsx} | 0 .../UnitsOfMeasure/Constants/decimal.fsx} | 0 .../UnitsOfMeasure/Constants/ieee32.fsx} | 0 .../UnitsOfMeasure/Constants/ieee64.fsx} | 0 .../Conformance/UnitsOfMeasure/Diagnostics.fs | 21 -- .../UnitsOfMeasure/Diagnostics/Diagnostics.fs | 226 ++++++++++++++++++ .../E_CantBeUsedAsPrefixArgToAType01.fsx | 0 .../E_CantBeUsedAsPrefixArgToAType02.fsx | 0 .../E_CantBeUsedAsPrefixArgToAType03.fsx | 0 .../E_CantBeUsedAsPrefixArgToAType04.fsx | 0 .../E_CantBeUsedAsPrefixArgToAType05.fsx | 0 .../E_ExpectedTypeNotUnitOfMeasure01.fsx} | 0 .../E_ExplicitUnitOfMeasureParameters01.fsx} | 0 .../E_ExplicitUnitOfMeasureParameters02.fsx} | 0 .../E_ExplicitUnitOfMeasureParameters03.fsx} | 0 .../E_ExplicitUnitOfMeasureParameters04.fsx} | 0 .../E_NonGenVarInValueRestrictionWarning.fsx} | 0 .../E_ParsingRationalExponents.fsx} | 0 .../Diagnostics/E_RangeExpression01.fsx} | 0 .../Diagnostics/E_RangeOfDecimals01.fsx} | 0 .../Diagnostics/E_RangeOfDimensioned03.fsx} | 0 .../E_UnexpectedTypeParameter01.fsx} | 0 .../Diagnostics/E_UnsupportedType01.fsx} | 0 .../Diagnostics/E_ZeroDenominator.fsx} | 0 .../Diagnostics/IntTypes01.fsx} | 2 +- .../Diagnostics/RangeExpression01.fsx} | 1 - .../Diagnostics/RangeOfDimensioned01.fsx} | 2 +- .../Diagnostics/RangeOfDimensioned02.fsx} | 4 +- .../W_UnitOfMeasureCodeLessGeneric01.fsx} | 0 .../UnitsOfMeasure/Operators/Operators.fs | 24 ++ .../Operators/Operators_decimal_01.fsx} | 0 .../Operators/Operators_float32_01.fsx} | 0 .../Operators/Operators_float_01.fsx} | 0 .../UnitsOfMeasure/Parenthesis/E_Error02.fsx} | 0 .../UnitsOfMeasure/Parenthesis/E_Error03.fsx} | 0 .../UnitsOfMeasure/Parenthesis/E_Error04.fsx} | 0 .../UnitsOfMeasure/Parenthesis/E_Error05.fsx} | 0 .../UnitsOfMeasure/Parenthesis/E_Error06.fsx} | 0 .../Parenthesis/E_IncompleteParens01.fsx} | 0 .../Parenthesis/E_IncompleteParens02.fsx} | 0 .../UnitsOfMeasure/Parenthesis/Parenthesis.fs | 106 ++++++++ .../Parenthesis/W_ImplicitProduct01.fsx} | 0 .../Parenthesis/W_Positive01.fsx} | 0 .../Conformance/UnitsOfMeasure/Parsing.fs | 55 ----- .../Parsing/E_KnownTypeAsUnit01b.fsx} | 0 .../UnitsOfMeasure/Parsing/E_Nesting01.fsx} | 0 .../Parsing/GreaterBarRBrack01.fsx} | 0 .../UnitsOfMeasure/Parsing/Parsing.fs | 72 ++++++ .../UnitsOfMeasure/Parsing/PowerSynonym.fsx} | 0 .../UnitsOfMeasure/Parsing/Quotient.fsx} | 0 .../UnitsOfMeasure/Parsing/QuotientAssoc.fsx} | 0 .../UnitsOfMeasure/Parsing/Reciprocal01.fsx} | 0 .../UnitsOfMeasure/Parsing/W_find_gtdef.fsx} | 0 .../Conformance/UnitsOfMeasure/TypeChecker.fs | 19 -- ...terfaceWithDifferentGenInstantiations.fsx} | 0 .../TypeChecker/E_typechecker01.fsx} | 0 .../TypeChecker/Generalization01.fsx} | 2 +- .../TypeChecker/GenericSubType01.fsx} | 0 .../TypeChecker/Slash_InFunction01.fsx} | 0 .../TypeChecker/Slash_InMethod01.fsx} | 0 .../TypeAbbreviation_decimal_01.fsx} | 2 +- .../TypeAbbreviation_float32_01.fsx} | 2 +- .../TypeAbbreviation_float_01.fsx} | 2 +- .../UnitsOfMeasure/TypeChecker/TypeChecker.fs | 117 +++++++++ .../TypeChecker/TypeConstraint02.fsx} | 0 .../TypeChecker/ValueRestriction01.fsx} | 0 .../TypeChecker/W_LessGeneric01.fsx | 0 .../TypeChecker/W_LessGeneric02.fsx} | 2 +- .../TypeChecker/W_TypeConstraint01.fsx} | 0 .../TypeChecker/W_TypeConstraint03.fsx} | 4 +- .../WithOOP/E_GenericUOM01.fsx} | 0 .../WithOOP/E_NoConstructorOnMeasure01.fsx} | 2 +- .../WithOOP/E_NoInstanceOnMeasure01.fsx} | 2 +- .../WithOOP/E_OverloadsDifferByUOMAttr.fsx} | 0 .../WithOOP/E_Polymorphism01.fsx | 5 +- .../UnitsOfMeasure/WithOOP/GenericUOM01.fsx} | 4 +- .../UnitsOfMeasure/WithOOP/InInterface01.fsx} | 4 +- .../WithOOP/Polymorphism02.fsx} | 2 +- .../WithOOP/StaticsOnMeasure01.fsx} | 2 +- .../UnitsOfMeasure/WithOOP/WithOOP.fs | 86 +++++++ .../FSharp.Compiler.ComponentTests.fsproj | 13 +- tests/FSharp.Test.Utilities/Compiler.fs | 3 +- .../UnitsOfMeasure/Basic/Calculus.fs | 31 --- .../UnitsOfMeasure/Basic/Misc01.fs | 9 - .../UnitsOfMeasure/Basic/Misc03.fs | 25 -- .../Basic/RationalExponents01.fs | 35 --- .../Conformance/UnitsOfMeasure/Basic/SI.fs | 32 --- .../Conformance/UnitsOfMeasure/Basic/Stats.fs | 32 --- .../Conformance/UnitsOfMeasure/Basic/env.lst | 18 -- .../Conformance/UnitsOfMeasure/Bounds/env.lst | 2 - .../UnitsOfMeasure/Constants/env.lst | 8 - .../UnitsOfMeasure/Diagnostics/env.lst | 29 --- .../UnitsOfMeasure/Operators/env.lst | 7 - .../UnitsOfMeasure/Parenthesis/env.lst | 13 - .../Parsing/GreaterBarRBrack01.fs | 18 -- .../Parsing/KnownTypeAsUnit01.fs | 25 -- .../UnitsOfMeasure/Parsing/Quotient.fs | 19 -- .../UnitsOfMeasure/Parsing/QuotientAssoc.fs | 24 -- .../UnitsOfMeasure/Parsing/Reciprocal01.fs | 17 -- .../UnitsOfMeasure/Parsing/env.lst | 4 - .../UnitsOfMeasure/TypeChecker/env.lst | 19 -- .../UnitsOfMeasure/WithOOP/env.lst | 10 - tests/fsharpqa/Source/test.lst | 10 - 126 files changed, 799 insertions(+), 578 deletions(-) delete mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Basic.fs rename tests/FSharp.Compiler.ComponentTests/{resources/tests/Conformance/UnitsOfMeasure/Basic/Calculus.fs => Conformance/UnitsOfMeasure/Basic/Calculus.fsx} (97%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/DynamicTypeTest.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/DynamicTypeTest.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/E_MassForce.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/E_MassForce.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Ints01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Ints01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Mars.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Mars.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/MassForce.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/MassForce.fsx} (100%) rename tests/FSharp.Compiler.ComponentTests/{resources/tests/Conformance/UnitsOfMeasure/Basic/Misc01.fs => Conformance/UnitsOfMeasure/Basic/Misc01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Misc02.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Misc02.fsx} (97%) rename tests/FSharp.Compiler.ComponentTests/{resources/tests/Conformance/UnitsOfMeasure/Basic/Misc03.fs => Conformance/UnitsOfMeasure/Basic/Misc03.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Misc04.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Misc04.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/OnDecimals01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/OnDecimals01.fsx} (100%) rename tests/FSharp.Compiler.ComponentTests/{resources/tests/Conformance/UnitsOfMeasure/Basic/Quotation04_hidden.fs => Conformance/UnitsOfMeasure/Basic/Quotation04_hidden.fsx} (100%) rename tests/FSharp.Compiler.ComponentTests/{resources/tests/Conformance/UnitsOfMeasure/Basic/RationalExponents01.fs => Conformance/UnitsOfMeasure/Basic/RationalExponents01.fsx} (100%) rename tests/FSharp.Compiler.ComponentTests/{resources/tests/Conformance/UnitsOfMeasure/Basic/SI.fs => Conformance/UnitsOfMeasure/Basic/SI.fsx} (100%) rename tests/FSharp.Compiler.ComponentTests/{resources/tests/Conformance/UnitsOfMeasure/Basic/Stats.fs => Conformance/UnitsOfMeasure/Basic/Stats.fsx} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Bounds/Bounds.fs rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Bounds/infinity_01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Bounds/infinity_01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Bounds/nan_01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Bounds/nan_01.fsx} (97%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/Constants.fs rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/E_UnsupportedTypes01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/E_UnsupportedTypes01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/SpecialSyntax_.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/SpecialSyntax_.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/decimal.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/decimal.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/ieee32.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/ieee32.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/ieee64.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/ieee64.fsx} (100%) delete mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics.fs create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/Diagnostics.fs rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType01.fsx (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType02.fsx (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType03.fsx (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType04.fsx (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType05.fsx (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ExpectedTypeNotUnitOfMeasure01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ExpectedTypeNotUnitOfMeasure01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters02.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters02.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters03.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters03.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters04.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters04.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/W_NonGenVarInValueRestrictionWarning.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_NonGenVarInValueRestrictionWarning.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ParsingRationalExponents.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ParsingRationalExponents.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_RangeExpression01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_RangeExpression01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_RangeOfDecimals01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_RangeOfDecimals01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_RangeOfDimensioned03.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_RangeOfDimensioned03.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_UnexpectedTypeParameter01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_UnexpectedTypeParameter01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_UnsupportedType01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_UnsupportedType01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ZeroDenominator.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ZeroDenominator.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/IntTypes01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/IntTypes01.fsx} (97%) rename tests/FSharp.Compiler.ComponentTests/{resources/tests/Conformance/UnitsOfMeasure/Diagnostics/RangeExpression01.fs => Conformance/UnitsOfMeasure/Diagnostics/RangeExpression01.fsx} (94%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/RangeOfDimensioned01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/RangeOfDimensioned01.fsx} (86%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/RangeOfDimensioned02.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/RangeOfDimensioned02.fsx} (70%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/W_UnitOfMeasureCodeLessGeneric01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/W_UnitOfMeasureCodeLessGeneric01.fsx} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Operators/Operators.fs rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Operators/Operators_decimal_01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Operators/Operators_decimal_01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Operators/Operators_float32_01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Operators/Operators_float32_01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Operators/Operators_float_01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Operators/Operators_float_01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_Error02.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_Error02.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_Error03.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_Error03.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_Error04.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_Error04.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_Error05.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_Error05.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_Error06.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_Error06.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_IncompleteParens01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_IncompleteParens01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_IncompleteParens02.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_IncompleteParens02.fsx} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/Parenthesis.fs rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/W_ImplicitProduct01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/W_ImplicitProduct01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/Positive01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/W_Positive01.fsx} (100%) delete mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing.fs rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/KnownTypeAsUnit01b.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/E_KnownTypeAsUnit01b.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/E_Nesting01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/E_Nesting01.fsx} (100%) rename tests/FSharp.Compiler.ComponentTests/{resources/tests/Conformance/UnitsOfMeasure/Parsing/GreaterBarRBrack01.fs => Conformance/UnitsOfMeasure/Parsing/GreaterBarRBrack01.fsx} (100%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/Parsing.fs rename tests/FSharp.Compiler.ComponentTests/{resources/tests/Conformance/UnitsOfMeasure/Parsing/PowerSynonym.fs => Conformance/UnitsOfMeasure/Parsing/PowerSynonym.fsx} (100%) rename tests/FSharp.Compiler.ComponentTests/{resources/tests/Conformance/UnitsOfMeasure/Parsing/Quotient.fs => Conformance/UnitsOfMeasure/Parsing/Quotient.fsx} (100%) rename tests/FSharp.Compiler.ComponentTests/{resources/tests/Conformance/UnitsOfMeasure/Parsing/QuotientAssoc.fs => Conformance/UnitsOfMeasure/Parsing/QuotientAssoc.fsx} (100%) rename tests/FSharp.Compiler.ComponentTests/{resources/tests/Conformance/UnitsOfMeasure/Parsing/Reciprocal01.fs => Conformance/UnitsOfMeasure/Parsing/Reciprocal01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/find_gtdef.fsx => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/W_find_gtdef.fsx} (100%) delete mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker.fs rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/E_GenInterfaceWithDifferentGenInstantiations.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/E_GenInterfaceWithDifferentGenInstantiations.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/typechecker01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/E_typechecker01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/Generalization01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/Generalization01.fsx} (94%) rename tests/FSharp.Compiler.ComponentTests/{resources/tests/Conformance/UnitsOfMeasure/TypeChecker/GenericSubType01.fs => Conformance/UnitsOfMeasure/TypeChecker/GenericSubType01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/Slash_InFunction01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/Slash_InFunction01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/Slash_InMethod01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/Slash_InMethod01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_decimal_01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_decimal_01.fsx} (87%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_float32_01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_float32_01.fsx} (86%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_float_01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_float_01.fsx} (87%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeChecker.fs rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeConstraint02.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeConstraint02.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/ValueRestriction01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/ValueRestriction01.fsx} (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/UnitsOfMeasure/TypeChecker/W_LessGeneric01.fsx (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/LessGeneric02.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/W_LessGeneric02.fsx} (99%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/W_TypeConstraint01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/W_TypeConstraint01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeConstraint03.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/W_TypeConstraint03.fsx} (88%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_GenericUOM01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/E_GenericUOM01.fsx} (100%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_NoConstructorOnMeasure01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/E_NoConstructorOnMeasure01.fsx} (97%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_NoInstanceOnMeasure01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/E_NoInstanceOnMeasure01.fsx} (97%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_OverloadsDifferByUOMAttr.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/E_OverloadsDifferByUOMAttr.fsx} (100%) rename tests/{fsharpqa/Source => FSharp.Compiler.ComponentTests}/Conformance/UnitsOfMeasure/WithOOP/E_Polymorphism01.fsx (94%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/GenericUOM01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/GenericUOM01.fsx} (95%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/InInterface01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/InInterface01.fsx} (96%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/Polymorphism02.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/Polymorphism02.fsx} (97%) rename tests/{fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/StaticsOnMeasure01.fs => FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/StaticsOnMeasure01.fsx} (96%) create mode 100644 tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/WithOOP.fs delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Calculus.fs delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Misc01.fs delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Misc03.fs delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/RationalExponents01.fs delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/SI.fs delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Stats.fs delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Bounds/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Operators/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/GreaterBarRBrack01.fs delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/KnownTypeAsUnit01.fs delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/Quotient.fs delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/QuotientAssoc.fs delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/Reciprocal01.fs delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/env.lst delete mode 100644 tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/env.lst diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked.fs index 8a0447a450e..b842f04de77 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/checked/checked.fs @@ -12,7 +12,7 @@ module Checked = [] let ``fsc-unchecked - unchecked01_fs`` compilation = compilation - |> getCompilation + |> getCompilation |> asFs |> compile |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic.fs deleted file mode 100644 index da86f949265..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic.fs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace Conformance.UnitsOfMeasure - -open Xunit -open FSharp.Test -open FSharp.Test.Compiler - -module Basic = - - // This test was automatically generated (moved from FSharpQA suite - Conformance/UnitsOfMeasure/Basic) - [] - let ``Basic - Misc01_fs`` compilation = - compilation - |> asFsx - |> typecheck - |> shouldSucceed - |> ignore - - // This test was automatically generated (moved from FSharpQA suite - Conformance/UnitsOfMeasure/Basic) - [] - let ``Basic - Misc03_fs`` compilation = - compilation - |> asFsx - |> typecheck - |> shouldSucceed - |> ignore - - // This test was automatically generated (moved from FSharpQA suite - Conformance/UnitsOfMeasure/Basic) - [] - let ``Basic - Stats_fs`` compilation = - compilation - |> asFsx - |> typecheck - |> shouldSucceed - |> ignore - - // This test was automatically generated (moved from FSharpQA suite - Conformance/UnitsOfMeasure/Basic) - [] - let ``Basic - SI_fs`` compilation = - compilation - |> asFsx - |> typecheck - |> shouldSucceed - |> ignore - - // This test was automatically generated (moved from FSharpQA suite - Conformance/UnitsOfMeasure/Basic) - [] - let ``Basic - RationalExponents01_fs`` compilation = - compilation - |> asFsx - |> typecheck - |> shouldSucceed - |> ignore - - // This test was automatically generated (moved from FSharpQA suite - Conformance/UnitsOfMeasure/Basic) - [] - let ``Basic - Quotation04_hidden_fs`` compilation = - compilation - |> asFsx - |> typecheck - |> shouldSucceed - |> ignore - diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Basic.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Basic.fs new file mode 100644 index 00000000000..ddb3a9fb049 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Basic.fs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.UnitsOfMeasure + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +module Basic = + let shouldFailWithDiagnostics expectedDiagnostics compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics expectedDiagnostics + + let shouldSucceed compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + let ``Basic - shouldSucceed`` compilation = + compilation + |> getCompilation + |> shouldSucceed + + [] + let ``Basic - E_MassForce`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 1, Line 15, Col 27, Line 15, Col 32, "The unit of measure 'N' does not match the unit of measure 'kg'") + (Error 43, Line 15, Col 25, Line 15, Col 26, "The unit of measure 'N' does not match the unit of measure 'kg'") + ] + + [] + let ``Basic - Misc02_fs`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Warning 64, Line 36, Col 60, Line 36, Col 61, "This construct causes code to be less generic than indicated by the type annotations. The unit-of-measure variable 'v has been constrained to be measure ''u/'w'.") + ] diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Basic/Calculus.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Calculus.fsx similarity index 97% rename from tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Basic/Calculus.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Calculus.fsx index 0263135fc55..cd91c9f2d2b 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Basic/Calculus.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Calculus.fsx @@ -18,6 +18,7 @@ let rec newton (f:float<_> -> float<_>) f' x xacc = else newton f f' x' xacc // Non-regular datatype: a list of derivatives of a function +[] type derivs<[] 'u, [] 'v> = Nil | Cons of (float<'u> -> float<'v>) * derivs<'u,'v/'u> diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/DynamicTypeTest.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/DynamicTypeTest.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/DynamicTypeTest.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/DynamicTypeTest.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/E_MassForce.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/E_MassForce.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/E_MassForce.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/E_MassForce.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Ints01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Ints01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Ints01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Ints01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Mars.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Mars.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Mars.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Mars.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/MassForce.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/MassForce.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/MassForce.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/MassForce.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Basic/Misc01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Misc01.fsx similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Basic/Misc01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Misc01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Misc02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Misc02.fsx similarity index 97% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Misc02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Misc02.fsx index 87e1f8d6025..79b036bef91 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Misc02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Misc02.fsx @@ -94,4 +94,4 @@ let r2 = (polyadd (new ComplexProd())) let weird(x:float<'u 'w>) (y:float<'v 'w>) (z:float<'w/'u 'v>) = 1 -if (r/1.0 = 14.0) && (r2/1.0 = 28.0) then exit 0 else 1 +(if (r/1.0 = 14.0) && (r2/1.0 = 28.0) then 0 else 1) |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Basic/Misc03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Misc03.fsx similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Basic/Misc03.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Misc03.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Misc04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Misc04.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Misc04.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Misc04.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/OnDecimals01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/OnDecimals01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/OnDecimals01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/OnDecimals01.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Basic/Quotation04_hidden.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Quotation04_hidden.fsx similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Basic/Quotation04_hidden.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Quotation04_hidden.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Basic/RationalExponents01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/RationalExponents01.fsx similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Basic/RationalExponents01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/RationalExponents01.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Basic/SI.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/SI.fsx similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Basic/SI.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/SI.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Basic/Stats.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Stats.fsx similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Basic/Stats.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Basic/Stats.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Bounds/Bounds.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Bounds/Bounds.fs new file mode 100644 index 00000000000..f2473d8a31e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Bounds/Bounds.fs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.UnitsOfMeasure + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +module Bounds = + let shouldFailWithDiagnostics expectedDiagnostics compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics expectedDiagnostics + + + [] + let ``infinity_01_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 717, Line 12, Col 18, Line 12, Col 27, "Unexpected type arguments") + (Error 717, Line 13, Col 18, Line 13, Col 26, "Unexpected type arguments") + (Error 717, Line 14, Col 19, Line 14, Col 28, "Unexpected type arguments") + (Error 717, Line 15, Col 19, Line 15, Col 27, "Unexpected type arguments") + ] + + [] + let ``nan_01_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 717, Line 7, Col 19, Line 7, Col 22, "Unexpected type arguments") + ] diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Bounds/infinity_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Bounds/infinity_01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Bounds/infinity_01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Bounds/infinity_01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Bounds/nan_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Bounds/nan_01.fsx similarity index 97% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Bounds/nan_01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Bounds/nan_01.fsx index 399089c85de..3272b6ad107 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Bounds/nan_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Bounds/nan_01.fsx @@ -5,4 +5,3 @@ #light [] type kg let mysterymass = nan -exit 1 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/Constants.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/Constants.fs new file mode 100644 index 00000000000..fd1d8440aef --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/Constants.fs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.UnitsOfMeasure + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +module Constants = + let shouldFailWithDiagnostics expectedDiagnostics compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics expectedDiagnostics + + let shouldSucceed compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + [] + [] + [] + [] + [] + let ``Constants - shouldSucceed`` compilation = + compilation + |> getCompilation + |> shouldSucceed + + [] + let ``E_UnsupportedTypes01_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 636, Line 22, Col 9, Line 22, Col 15, "Units-of-measure are only supported on float, float32, decimal, and integer types.") + (Error 636, Line 23, Col 9, Line 23, Col 15, "Units-of-measure are only supported on float, float32, decimal, and integer types.") + ] diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/E_UnsupportedTypes01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/E_UnsupportedTypes01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/E_UnsupportedTypes01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/E_UnsupportedTypes01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/SpecialSyntax_.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/SpecialSyntax_.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/SpecialSyntax_.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/SpecialSyntax_.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/decimal.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/decimal.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/decimal.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/decimal.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/ieee32.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/ieee32.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/ieee32.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/ieee32.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/ieee64.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/ieee64.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/ieee64.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Constants/ieee64.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics.fs deleted file mode 100644 index df101be4a31..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics.fs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace Conformance.UnitsOfMeasure - -open Xunit -open FSharp.Test -open FSharp.Test.Compiler - -module Diagnostics = - - // This test was automatically generated (moved from FSharpQA suite - Conformance/UnitsOfMeasure/Diagnostics) - // - [] - let ``Diagnostics - RangeExpression01_fs - --test:ErrorRanges`` compilation = - compilation - |> asFsx - |> withOptions ["--test:ErrorRanges"] - |> compile - |> shouldSucceed - |> ignore - diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/Diagnostics.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/Diagnostics.fs new file mode 100644 index 00000000000..703dc3cb517 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/Diagnostics.fs @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.UnitsOfMeasure + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +module Diagnostics = + + let shouldFailWithDiagnostics expectedDiagnostics compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> compile + |> shouldFail + |> withDiagnostics expectedDiagnostics + + let shouldSucceedWithDiagnostics expectedDiagnostics compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> ignoreWarnings + |> compile + |> shouldSucceed + |> withDiagnostics expectedDiagnostics + + let shouldSucceed compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> compile + |> shouldSucceed + + [] + [] + [] + [] + [] + let ``Diagnostics - shouldSucceed`` compilation = + compilation + |> getCompilation + |> shouldSucceed + + [] + let ``E_CantBeUsedAsPrefixArgToAType01_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 706, Line 9, Col 12, Line 9, Col 29, "Units-of-measure cannot be used as prefix arguments to a type. Rewrite as postfix arguments in angle brackets.") + ] + + [] + let ``E_CantBeUsedAsPrefixArgToAType02_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 706, Line 9, Col 12, Line 9, Col 24, "Units-of-measure cannot be used as prefix arguments to a type. Rewrite as postfix arguments in angle brackets.") + ] + + [] + let ``E_CantBeUsedAsPrefixArgToAType03_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 706, Line 9, Col 12, Line 9, Col 27, "Units-of-measure cannot be used as prefix arguments to a type. Rewrite as postfix arguments in angle brackets.") + ] + + [] + let ``E_CantBeUsedAsPrefixArgToAType04_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 706, Line 9, Col 12, Line 9, Col 21, "Units-of-measure cannot be used as prefix arguments to a type. Rewrite as postfix arguments in angle brackets.") + ] + + [] + let ``E_CantBeUsedAsPrefixArgToAType05_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 716, Line 10, Col 12, Line 10, Col 21, "Unexpected / in type") + (Error 704, Line 10, Col 12, Line 10, Col 13, "Expected type, not unit-of-measure") + (Error 706, Line 10, Col 14, Line 10, Col 21, "Units-of-measure cannot be used as prefix arguments to a type. Rewrite as postfix arguments in angle brackets.") + ] + + [] + let ``E_ExpectedTypeNotUnitOfMeasure01_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 33, Line 11, Col 10, Line 11, Col 19, "The non-generic type 'Microsoft.FSharp.Core.string' does not expect any type arguments, but here is given 1 type argument(s)") + (Error 704, Line 12, Col 11, Line 12, Col 12, "Expected type, not unit-of-measure") + (Error 704, Line 13, Col 17, Line 13, Col 18, "Expected type, not unit-of-measure") + (Error 704, Line 14, Col 49, Line 14, Col 50, "Expected type, not unit-of-measure") + ] + + [] + let ``E_ExplicitUnitOfMeasureParameters01_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 702, Line 6, Col 41, Line 6, Col 43, "Expected unit-of-measure parameter, not type parameter. Explicit unit-of-measure parameters must be marked with the [] attribute.") + ] + + [] + let ``E_ExplicitUnitOfMeasureParameters02_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 702, Line 6, Col 45, Line 6, Col 47, "Expected unit-of-measure parameter, not type parameter. Explicit unit-of-measure parameters must be marked with the [] attribute.") + ] + + [] + let ``E_ExplicitUnitOfMeasureParameters03_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 702, Line 6, Col 33, Line 6, Col 35, "Expected unit-of-measure parameter, not type parameter. Explicit unit-of-measure parameters must be marked with the [] attribute.") + (Warning 1178, Line 6, Col 6, Line 6, Col 12, "The struct, record or union type 'T_2920' is not structurally comparable because the type 'obj' does not satisfy the 'comparison' constraint. Consider adding the 'NoComparison' attribute to the type 'T_2920' to clarify that the type is not comparable") + ] + + [] + let ``E_ExplicitUnitOfMeasureParameters04_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 702, Line 6, Col 27, Line 6, Col 29, "Expected unit-of-measure parameter, not type parameter. Explicit unit-of-measure parameters must be marked with the [] attribute.") + (Error 35, Line 6, Col 6, Line 6, Col 12, "This construct is deprecated: This type abbreviation has one or more declared type parameters that do not appear in the type being abbreviated. Type abbreviations must use all declared type parameters in the type being abbreviated. Consider removing one or more type parameters, or use a concrete type definition that wraps an underlying type, such as 'type C<'a> = C of ...'.") + ] + + [] + let ``E_NonGenVarInValueRestrictionWarning_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 30, Line 6, Col 5, Line 6, Col 6, """Value restriction: The value 'x' has an inferred generic type + val x: float<'_u> list ref + However, values cannot have generic type variables like '_a in "let x: '_a". You can do one of the following: + - Define it as a simple data term like an integer literal, a string literal or a union case like "let x = 1" + - Add an explicit type annotation like "let x : int" + - Use the value as a non-generic type in later code for type inference like "do x" + or if you still want type-dependent results, you can define 'x' as a function instead by doing either: + - Add a unit parameter like "let x()" + - Write explicit type parameters like "let x<'a>". + This error is because a let binding without parameters defines a value, not a function. Values cannot be generic because reading a value is assumed to result in the same everywhere but generic type parameters may invalidate this assumption by enabling type-dependent results.""") + (Error 30, Line 7, Col 5, Line 7, Col 6, """Value restriction: The value 'y' has an inferred generic type + val y: '_a list ref + However, values cannot have generic type variables like '_a in "let x: '_a". You can do one of the following: + - Define it as a simple data term like an integer literal, a string literal or a union case like "let x = 1" + - Add an explicit type annotation like "let x : int" + - Use the value as a non-generic type in later code for type inference like "do x" + or if you still want type-dependent results, you can define 'y' as a function instead by doing either: + - Add a unit parameter like "let x()" + - Write explicit type parameters like "let x<'a>". + This error is because a let binding without parameters defines a value, not a function. Values cannot be generic because reading a value is assumed to result in the same everywhere but generic type parameters may invalidate this assumption by enabling type-dependent results.""") + ] + + [] + let ``E_ParsingRationalExponents_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 620, Line 11, Col 19, Line 11, Col 20, "Unexpected integer literal in unit-of-measure expression") + (Error 10, Line 12, Col 20, Line 12, Col 21, "Unexpected symbol ')' in binding. Expected integer literal or other token.") + (Error 10, Line 13, Col 18, Line 13, Col 19, "Unexpected infix operator in binding. Expected integer literal, '-' or other token.") + ] + + [] + let ``E_RangeOfDecimals01_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 1, Line 8, Col 16, Line 8, Col 23, "The type 'decimal' does not match the type 'decimal'") + ] + + [] + let ``E_RangeOfDimensioned03_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 1, Line 7, Col 11, Line 7, Col 18, "The type 'float' does not match the type 'float'") + (Error 1, Line 7, Col 22, Line 7, Col 28, """Type mismatch. Expecting a +'float' +but given a +'float' +The unit of measure 'Kg' does not match the unit of measure 's'""") + (Error 1, Line 9, Col 22, Line 9, Col 28, "The unit of measure 's' does not match the unit of measure 'Kg'") + ] + + [] + let ``E_UnexpectedTypeParameter01_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 634, Line 7, Col 15, Line 7, Col 17, "Non-zero constants cannot have generic units. For generic zero, write 0.0<_>.") + (Error 634, Line 8, Col 16, Line 8, Col 18, "Non-zero constants cannot have generic units. For generic zero, write 0.0<_>.") + (Error 634, Line 9, Col 16, Line 9, Col 18, "Non-zero constants cannot have generic units. For generic zero, write 0.0<_>.") + ] + + [] + let ``E_UnsupportedType01_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 636, Line 9, Col 9, Line 9, Col 15, "Units-of-measure are only supported on float, float32, decimal, and integer types.") + ] + + [] + let ``E_ZeroDenominator_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 625, Line 8, Col 19, Line 8, Col 20, "Denominator must not be 0 in unit-of-measure exponent") + (Error 625, Line 9, Col 21, Line 9, Col 22, "Denominator must not be 0 in unit-of-measure exponent") + ] + + [] + let ``W_UnitOfMeasureCodeLessGeneric01_fsx`` compilation = + compilation + |> getCompilation + |> shouldSucceedWithDiagnostics [ + (Warning 64, Line 5, Col 30, Line 5, Col 31, "This construct causes code to be less generic than indicated by the type annotations. The unit-of-measure variable 'a has been constrained to be measure '1'.") + ] + + diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType01.fsx rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType02.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType02.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType02.fsx rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType02.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType03.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType03.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType03.fsx rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType03.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType04.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType04.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType04.fsx rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType04.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType05.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType05.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType05.fsx rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_CantBeUsedAsPrefixArgToAType05.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ExpectedTypeNotUnitOfMeasure01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ExpectedTypeNotUnitOfMeasure01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ExpectedTypeNotUnitOfMeasure01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ExpectedTypeNotUnitOfMeasure01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters02.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters02.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters03.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters03.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters03.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters04.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters04.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ExplicitUnitOfMeasureParameters04.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/W_NonGenVarInValueRestrictionWarning.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_NonGenVarInValueRestrictionWarning.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/W_NonGenVarInValueRestrictionWarning.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_NonGenVarInValueRestrictionWarning.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ParsingRationalExponents.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ParsingRationalExponents.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ParsingRationalExponents.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ParsingRationalExponents.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_RangeExpression01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_RangeExpression01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_RangeExpression01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_RangeExpression01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_RangeOfDecimals01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_RangeOfDecimals01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_RangeOfDecimals01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_RangeOfDecimals01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_RangeOfDimensioned03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_RangeOfDimensioned03.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_RangeOfDimensioned03.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_RangeOfDimensioned03.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_UnexpectedTypeParameter01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_UnexpectedTypeParameter01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_UnexpectedTypeParameter01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_UnexpectedTypeParameter01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_UnsupportedType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_UnsupportedType01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_UnsupportedType01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_UnsupportedType01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ZeroDenominator.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ZeroDenominator.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/E_ZeroDenominator.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/E_ZeroDenominator.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/IntTypes01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/IntTypes01.fsx similarity index 97% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/IntTypes01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/IntTypes01.fsx index aa6402c8405..486eec82180 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/IntTypes01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/IntTypes01.fsx @@ -9,4 +9,4 @@ let b = 1 * 1 // int=int32 let c = 1s / 1s // int16 let d = 1y + 1y // int8 -exit 0 +ignore 0 diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Diagnostics/RangeExpression01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/RangeExpression01.fsx similarity index 94% rename from tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Diagnostics/RangeExpression01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/RangeExpression01.fsx index c2ba1e3df38..5124be877c5 100644 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Diagnostics/RangeExpression01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/RangeExpression01.fsx @@ -10,4 +10,3 @@ type foo let m, n = 1, 10 [m .. 1 .. n] // OK -printfn "Finished" diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/RangeOfDimensioned01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/RangeOfDimensioned01.fsx similarity index 86% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/RangeOfDimensioned01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/RangeOfDimensioned01.fsx index 028d13cfb5d..940800dbe51 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/RangeOfDimensioned01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/RangeOfDimensioned01.fsx @@ -7,4 +7,4 @@ let v1 = [1.0 .. 1.0 .. 3.0] |> Seq.sum -(if v1 = 6.0 then 0 else 1) |> exit +(if v1 = 6.0 then 0 else 1) |> ignore diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/RangeOfDimensioned02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/RangeOfDimensioned02.fsx similarity index 70% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/RangeOfDimensioned02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/RangeOfDimensioned02.fsx index 60007529f20..a692428ab3e 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/RangeOfDimensioned02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/RangeOfDimensioned02.fsx @@ -5,8 +5,8 @@ [] type Kg -let v1 = [1.0 .. 2.0 .. 5.0] |> Seq.nth 1 +let v1 = [1.0 .. 2.0 .. 5.0] |> Seq.item 1 -(if v1 = 3.0 then 0 else 1) |> exit +(if v1 = 3.0 then 0 else 1) |> ignore diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/W_UnitOfMeasureCodeLessGeneric01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/W_UnitOfMeasureCodeLessGeneric01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/W_UnitOfMeasureCodeLessGeneric01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Diagnostics/W_UnitOfMeasureCodeLessGeneric01.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Operators/Operators.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Operators/Operators.fs new file mode 100644 index 00000000000..34b4f119447 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Operators/Operators.fs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.UnitsOfMeasure + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +module Operators = + let shouldSucceed compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + [] + [] + [] + [] + let ``Operators - shouldSucceed`` compilation = + compilation + |> getCompilation + |> shouldSucceed diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Operators/Operators_decimal_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Operators/Operators_decimal_01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Operators/Operators_decimal_01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Operators/Operators_decimal_01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Operators/Operators_float32_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Operators/Operators_float32_01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Operators/Operators_float32_01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Operators/Operators_float32_01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Operators/Operators_float_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Operators/Operators_float_01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Operators/Operators_float_01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Operators/Operators_float_01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_Error02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_Error02.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_Error02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_Error02.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_Error03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_Error03.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_Error03.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_Error03.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_Error04.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_Error04.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_Error04.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_Error04.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_Error05.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_Error05.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_Error05.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_Error05.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_Error06.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_Error06.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_Error06.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_Error06.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_IncompleteParens01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_IncompleteParens01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_IncompleteParens01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_IncompleteParens01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_IncompleteParens02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_IncompleteParens02.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/E_IncompleteParens02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/E_IncompleteParens02.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/Parenthesis.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/Parenthesis.fs new file mode 100644 index 00000000000..16df852fb55 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/Parenthesis.fs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.UnitsOfMeasure + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +module Parenthesis = + let shouldFailWithDiagnostics expectedDiagnostics compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics expectedDiagnostics + + let shouldSucceedWithDiagnostics expectedDiagnostics compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> ignoreWarnings + |> typecheck + |> shouldSucceed + |> withDiagnostics expectedDiagnostics + + let shouldSucceed compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + [] + let ``E_Error02_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 620, Line 11, Col 19, Line 11, Col 20, "Unexpected integer literal in unit-of-measure expression") + ] + + [] + let ``E_Error03_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 10, Line 11, Col 31, Line 11, Col 32, "Unexpected symbol ')' in binding") + ] + + [] + let ``E_Error04_fs`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 10, Line 11, Col 34, Line 11, Col 35, "Unexpected symbol '_' in binding") + ] + + [] + let ``E_Error05_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 10, Line 11, Col 28, Line 11, Col 29, "Unexpected symbol ')' in binding") + ] + + [] + let ``E_Error06_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 620, Line 11, Col 20, Line 11, Col 23, "Unexpected integer literal in unit-of-measure expression") + ] + + [] + let ``E_IncompleteParens01_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 10, Line 11, Col 1, Line 11, Col 1, "Incomplete structured construct at or before this point in expression. Expected ')' or other token.") + (Error 583, Line 10, Col 26, Line 10, Col 27, "Unmatched '('") + ] + + [] + let ``E_IncompleteParens02_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 3156, Line 11, Col 24, Line 11, Col 25, "Unexpected token '/' or incomplete expression") + (Error 10, Line 11, Col 26, Line 11, Col 27, "Unexpected symbol ')' in binding. Expected incomplete structured construct at or before this point or other token.") + ] + + [] + let ``W_ImplicitProduct01_fsx`` compilation = + compilation + |> getCompilation + |> shouldSucceedWithDiagnostics [ + (Warning 632, Line 11, Col 25, Line 11, Col 32, "Implicit product of measures following /") + ] + + [] + let ``W_Positive01_fsx`` compilation = + compilation + |> getCompilation + |> shouldSucceedWithDiagnostics [ + (Warning 464, Line 24, Col 33, Line 24, Col 39, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") + ] diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/W_ImplicitProduct01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/W_ImplicitProduct01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/W_ImplicitProduct01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/W_ImplicitProduct01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/Positive01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/W_Positive01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/Positive01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parenthesis/W_Positive01.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing.fs deleted file mode 100644 index 6dc46f8013f..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing.fs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace Conformance.UnitsOfMeasure - -open Xunit -open FSharp.Test -open FSharp.Test.Compiler - -module Parsing = - - // This test was automatically generated (moved from FSharpQA suite - Conformance/UnitsOfMeasure/Parsing) - [] - let ``Parsing - GreaterBarRBrack01_fs`` compilation = - compilation - |> asFsx - |> typecheck - |> shouldSucceed - |> ignore - - // This test was automatically generated (moved from FSharpQA suite - Conformance/UnitsOfMeasure/Parsing) - [] - let ``Parsing - Reciprocal01_fs`` compilation = - compilation - |> asFsx - |> typecheck - |> shouldSucceed - |> ignore - - // This test was automatically generated (moved from FSharpQA suite - Conformance/UnitsOfMeasure/Parsing) - [] - let ``Parsing - QuotientAssoc_fs`` compilation = - compilation - |> asFsx - |> typecheck - |> shouldSucceed - |> ignore - - // This test was automatically generated (moved from FSharpQA suite - Conformance/UnitsOfMeasure/Parsing) - [] - let ``Parsing - Quotient_fs`` compilation = - compilation - |> asFsx - |> typecheck - |> shouldSucceed - |> ignore - - // This test was automatically generated (moved from FSharpQA suite - Conformance/UnitsOfMeasure/Parsing) - [] - let ``Parsing - PowerSynonym_fs`` compilation = - compilation - |> asFsx - |> typecheck - |> shouldSucceed - |> ignore - diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/KnownTypeAsUnit01b.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/E_KnownTypeAsUnit01b.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/KnownTypeAsUnit01b.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/E_KnownTypeAsUnit01b.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/E_Nesting01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/E_Nesting01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/E_Nesting01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/E_Nesting01.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Parsing/GreaterBarRBrack01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/GreaterBarRBrack01.fsx similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Parsing/GreaterBarRBrack01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/GreaterBarRBrack01.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/Parsing.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/Parsing.fs new file mode 100644 index 00000000000..6b2b654517f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/Parsing.fs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.UnitsOfMeasure + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +module Parsing = + let shouldFailWithDiagnostics expectedDiagnostics compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics expectedDiagnostics + + let shouldSucceedWithDiagnostics expectedDiagnostics compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> ignoreWarnings + |> typecheck + |> shouldSucceed + |> withDiagnostics expectedDiagnostics + + let shouldSucceed compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + [] + [] + [] + [] + [] + [] + let ``Parsing - shouldSucceed`` compilation = + compilation + |> getCompilation + |> shouldSucceed + + [] + let ``E_KnownTypeAsUnit01b_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 705, Line 14, Col 9, Line 14, Col 14, "Expected unit-of-measure, not type") + (Error 705, Line 17, Col 17, Line 17, Col 20, "Expected unit-of-measure, not type") + (Error 705, Line 20, Col 24, Line 20, Col 27, "Expected unit-of-measure, not type") + (Error 705, Line 23, Col 37, Line 23, Col 42, "Expected unit-of-measure, not type") + (Error 705, Line 26, Col 38, Line 26, Col 41, "Expected unit-of-measure, not type") + ] + + [] + let ``E_Nesting01_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 714, Line 12, Col 19, Line 12, Col 20, "Anonymous unit-of-measure cannot be nested inside another unit-of-measure expression") + (Error 707, Line 17, Col 17, Line 17, Col 21, "Unit-of-measure cannot be used in type constructor application") + ] + + [] + let ``W_find_gtdef_fsx`` compilation = + compilation + |> getCompilation + |> shouldSucceedWithDiagnostics [ + (Warning 64, Line 16, Col 21, Line 16, Col 22, "This construct causes code to be less generic than indicated by the type annotations. The unit-of-measure variable 'u has been constrained to be measure 'Continuous'.") + ] diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Parsing/PowerSynonym.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/PowerSynonym.fsx similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Parsing/PowerSynonym.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/PowerSynonym.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Parsing/Quotient.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/Quotient.fsx similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Parsing/Quotient.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/Quotient.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Parsing/QuotientAssoc.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/QuotientAssoc.fsx similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Parsing/QuotientAssoc.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/QuotientAssoc.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Parsing/Reciprocal01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/Reciprocal01.fsx similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/Parsing/Reciprocal01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/Reciprocal01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/find_gtdef.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/W_find_gtdef.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/find_gtdef.fsx rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/Parsing/W_find_gtdef.fsx diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker.fs deleted file mode 100644 index 34d3de20940..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker.fs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace Conformance.UnitsOfMeasure - -open Xunit -open FSharp.Test -open FSharp.Test.Compiler - -module TypeChecker = - - // This test was automatically generated (moved from FSharpQA suite - Conformance/UnitsOfMeasure/TypeChecker) - [] - let ``TypeChecker - GenericSubType01_fs`` compilation = - compilation - |> asFsx - |> typecheck - |> shouldSucceed - |> ignore - diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/E_GenInterfaceWithDifferentGenInstantiations.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/E_GenInterfaceWithDifferentGenInstantiations.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/E_GenInterfaceWithDifferentGenInstantiations.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/E_GenInterfaceWithDifferentGenInstantiations.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/typechecker01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/E_typechecker01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/typechecker01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/E_typechecker01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/Generalization01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/Generalization01.fsx similarity index 94% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/Generalization01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/Generalization01.fsx index c46cefad1f4..53494495f23 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/Generalization01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/Generalization01.fsx @@ -14,4 +14,4 @@ type T = static member star ( y:'b when 'b :> M<'a>) = 0 let p = 1 let m = Unchecked.defaultof> -T.star(m) |> exit +T.star(m) |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/TypeChecker/GenericSubType01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/GenericSubType01.fsx similarity index 100% rename from tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/UnitsOfMeasure/TypeChecker/GenericSubType01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/GenericSubType01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/Slash_InFunction01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/Slash_InFunction01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/Slash_InFunction01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/Slash_InFunction01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/Slash_InMethod01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/Slash_InMethod01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/Slash_InMethod01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/Slash_InMethod01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_decimal_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_decimal_01.fsx similarity index 87% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_decimal_01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_decimal_01.fsx index bcb68704da5..b6231bdc933 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_decimal_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_decimal_01.fsx @@ -10,4 +10,4 @@ module WithDecimal = let a = 100.0M let a_na = a * 2.0M // Bug #3427 let b : Ab = 100.0M - (if (b*2.0M = 200.0M) then 0 else 1) |> exit + (if (b*2.0M = 200.0M) then 0 else 1) |> ignore diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_float32_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_float32_01.fsx similarity index 86% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_float32_01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_float32_01.fsx index 3a4b5c44f18..cf52976f431 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_float32_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_float32_01.fsx @@ -10,5 +10,5 @@ module WithFloat32 = let a = 100.0f let a_na = a * 2.0f let b : Ab = 100.0f - (if (b*2.0f = 200.0f) then 0 else 1) |> exit + (if (b*2.0f = 200.0f) then 0 else 1) |> ignore diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_float_01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_float_01.fsx similarity index 87% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_float_01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_float_01.fsx index 015e097a977..5075586b4d2 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_float_01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeAbbreviation_float_01.fsx @@ -12,5 +12,5 @@ module WithFloat = let a_na = a * 2.0 let b : Ab = 100.0 - (if (b*2.0 = 200.0) then 0 else 1) |> exit + (if (b*2.0 = 200.0) then 0 else 1) |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeChecker.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeChecker.fs new file mode 100644 index 00000000000..7b511e22b41 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeChecker.fs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.UnitsOfMeasure + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +module TypeChecker = + let shouldFailWithDiagnostics expectedDiagnostics compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics expectedDiagnostics + + let shouldSucceedWithDiagnostics expectedDiagnostics compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> ignoreWarnings + |> typecheck + |> shouldSucceed + |> withDiagnostics expectedDiagnostics + + let shouldSucceed compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + [] + [] + [] + [] + [] + [] + [] + [] + [] + [] + let ``TypeChecker - shouldSucceed`` compilation = + compilation + |> getCompilation + |> shouldSucceed + + + [] + let ``E_GenInterfaceWithDifferentGenInstantiations_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 3360, Line 13, Col 6, Line 13, Col 8, "'IB<'b>' cannot implement the interface 'IA<_>' with the two instantiations 'IA' and 'IA<'b>' because they may unify.") + ] + + [] + let ``E_typechecker01_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 687, Line 8, Col 1, Line 8, Col 2, "This value, type or method expects 2 type parameter(s) but was given 1") + ] + + [] + let ``W_LessGeneric01_fsx`` compilation = + compilation + |> getCompilation + |> shouldSucceedWithDiagnostics [ + (Warning 64, Line 18, Col 17, Line 18, Col 19, "This construct causes code to be less generic than indicated by the type annotations. The unit-of-measure variable 'u has been constrained to be measure '1'.") + ] + + [] + let ``W_LessGeneric02_fsx`` compilation = + compilation + |> getCompilation + |> shouldSucceedWithDiagnostics [ + (Warning 464, Line 9, Col 18, Line 9, Col 25, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") + (Warning 464, Line 10, Col 18, Line 10, Col 25, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") + (Warning 464, Line 11, Col 18, Line 11, Col 25, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") + (Warning 464, Line 12, Col 18, Line 12, Col 25, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") + (Warning 464, Line 13, Col 18, Line 13, Col 25, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") + (Warning 464, Line 14, Col 18, Line 14, Col 25, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") + (Warning 464, Line 15, Col 18, Line 15, Col 25, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") + (Warning 464, Line 16, Col 18, Line 16, Col 25, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") + (Warning 464, Line 17, Col 18, Line 17, Col 25, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") + (Warning 464, Line 18, Col 18, Line 18, Col 25, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") + (Warning 464, Line 19, Col 18, Line 19, Col 25, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") + (Warning 464, Line 20, Col 18, Line 20, Col 25, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") + (Warning 464, Line 21, Col 18, Line 21, Col 25, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") + (Warning 464, Line 22, Col 18, Line 22, Col 25, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") + (Warning 464, Line 23, Col 18, Line 23, Col 25, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") + (Warning 464, Line 24, Col 18, Line 24, Col 25, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") + (Warning 464, Line 25, Col 21, Line 25, Col 28, "This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'.") + ] + + [] + let ``W_TypeConstraint01_fsx`` compilation = + compilation + |> getCompilation + |> shouldSucceedWithDiagnostics [ + (Warning 64, Line 11, Col 7, Line 11, Col 14, "This construct causes code to be less generic than indicated by the type annotations. The unit-of-measure variable 'u has been constrained to be measure 'kg'.") + (Warning 64, Line 11, Col 19, Line 11, Col 26, "This construct causes code to be less generic than indicated by the type annotations. The unit-of-measure variable 'v has been constrained to be measure 'kg'.") + ] + + [] + let ``W_TypeConstraint03_fsx`` compilation = + compilation + |> getCompilation + |> shouldSucceedWithDiagnostics [ +#if NETFRAMEWORK + (Warning 52, Line 10, Col 7, Line 10, Col 21, "The value has been copied to ensure the original is not mutated by this operation or because the copy is implicit when returning a struct from a member and another member is then accessed") +#endif + ] diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeConstraint02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeConstraint02.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeConstraint02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/TypeConstraint02.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/ValueRestriction01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/ValueRestriction01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/ValueRestriction01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/ValueRestriction01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/W_LessGeneric01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/W_LessGeneric01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/W_LessGeneric01.fsx rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/W_LessGeneric01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/LessGeneric02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/W_LessGeneric02.fsx similarity index 99% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/LessGeneric02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/W_LessGeneric02.fsx index 51b928922a3..55fe6960ad4 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/LessGeneric02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/W_LessGeneric02.fsx @@ -26,4 +26,4 @@ let sq = } |> Seq.sum -exit 0 +ignore 0 diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/W_TypeConstraint01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/W_TypeConstraint01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/W_TypeConstraint01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/W_TypeConstraint01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeConstraint03.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/W_TypeConstraint03.fsx similarity index 88% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeConstraint03.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/W_TypeConstraint03.fsx index 4fe15a1481e..686f194055e 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/TypeConstraint03.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/TypeChecker/W_TypeConstraint03.fsx @@ -8,5 +8,5 @@ type x = System.Nullable> let x_obj = Unchecked.defaultof match x_obj.HasValue with -| false -> exit 0 -| _ -> exit 1 \ No newline at end of file +| false -> ignore 0 +| _ -> ignore 1 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_GenericUOM01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/E_GenericUOM01.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_GenericUOM01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/E_GenericUOM01.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_NoConstructorOnMeasure01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/E_NoConstructorOnMeasure01.fsx similarity index 97% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_NoConstructorOnMeasure01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/E_NoConstructorOnMeasure01.fsx index aa1a38aefd3..9149a410877 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_NoConstructorOnMeasure01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/E_NoConstructorOnMeasure01.fsx @@ -10,4 +10,4 @@ type kg = static member Foo() = 1 let objKg = 1.0f -exit 1 +ignore 1 diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_NoInstanceOnMeasure01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/E_NoInstanceOnMeasure01.fsx similarity index 97% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_NoInstanceOnMeasure01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/E_NoInstanceOnMeasure01.fsx index 4ff94cf8683..8a3a857491c 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_NoInstanceOnMeasure01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/E_NoInstanceOnMeasure01.fsx @@ -8,4 +8,4 @@ type kg = member this.Foo() = 5 -exit 1 +ignore 1 diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_OverloadsDifferByUOMAttr.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/E_OverloadsDifferByUOMAttr.fsx similarity index 100% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_OverloadsDifferByUOMAttr.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/E_OverloadsDifferByUOMAttr.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_Polymorphism01.fsx b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/E_Polymorphism01.fsx similarity index 94% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_Polymorphism01.fsx rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/E_Polymorphism01.fsx index 961af529c02..f33870b14f6 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/E_Polymorphism01.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/E_Polymorphism01.fsx @@ -14,8 +14,5 @@ type Meter() = type Value< [] 'a > = float<'a> * Unit<'a> -#if INTERACTIVE -;; -exit 1;; -#endif +ignore 1 diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/GenericUOM01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/GenericUOM01.fsx similarity index 95% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/GenericUOM01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/GenericUOM01.fsx index 3fd973024cd..30fe2cd9c98 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/GenericUOM01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/GenericUOM01.fsx @@ -23,6 +23,6 @@ let y = x.Foo 1.0 if y <> 5.0 then - exit 1 + ignore 1 -exit 0 +ignore 0 diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/InInterface01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/InInterface01.fsx similarity index 96% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/InInterface01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/InInterface01.fsx index ec5f4282007..42b23b9e271 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/InInterface01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/InInterface01.fsx @@ -31,6 +31,6 @@ let testResult = | _ -> true if testResult = false then - exit 1 + ignore 1 -exit 0 +ignore 0 diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/Polymorphism02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/Polymorphism02.fsx similarity index 97% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/Polymorphism02.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/Polymorphism02.fsx index ad94a9d4e1f..8161b0560f7 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/Polymorphism02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/Polymorphism02.fsx @@ -13,4 +13,4 @@ type Unit<[] 'a >() = let objUnit = new Unit() if objUnit.Factor() <> 1.0 then exit 1 -exit 0 +ignore 0 diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/StaticsOnMeasure01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/StaticsOnMeasure01.fsx similarity index 96% rename from tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/StaticsOnMeasure01.fs rename to tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/StaticsOnMeasure01.fsx index ead91c1ad14..58047848f92 100644 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/StaticsOnMeasure01.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/StaticsOnMeasure01.fsx @@ -11,4 +11,4 @@ type kg = if kg.Prop <> 5 then exit 1 if kg.Func 3 <> 4 then exit 1 -exit 0 +ignore 0 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/WithOOP.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/WithOOP.fs new file mode 100644 index 00000000000..3b416979e43 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/UnitsOfMeasure/WithOOP/WithOOP.fs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.UnitsOfMeasure + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +module WithOOP = + let shouldFailWithDiagnostics expectedDiagnostics compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withDiagnostics expectedDiagnostics + + let shouldSucceedWithDiagnostics expectedDiagnostics compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> ignoreWarnings + |> typecheck + |> shouldSucceed + |> withDiagnostics expectedDiagnostics + + let shouldSucceed compilation = + compilation + |> asLibrary + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldSucceed + + [] + [] + [] + [] + [] + let ``TypeChecker - shouldSucceed`` compilation = + compilation + |> getCompilation + |> shouldSucceed + + [] + let ``E_GenericUOM01_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 842, Line 8, Col 36, Line 8, Col 51, "This attribute is not valid for use on this language element") + ] + + [] + let ``E_NoConstructorOnMeasure01_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 904, Line 8, Col 5, Line 8, Col 18, "Measure declarations may have only static members: constructors are not available") + ] + + [] + let ``E_NoInstanceOnMeasure01_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 897, Line 9, Col 5, Line 9, Col 26, "Measure declarations may have only static members") + ] + + + [] + let ``E_OverloadsDifferByUOMAttr_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 438, Line 10, Col 5, Line 10, Col 8, "Duplicate method. The method '.ctor' has the same name and signature as another method in type 'Foo<'a>' once tuples, functions, units of measure and/or provided types are erased.") + (Error 438, Line 9, Col 5, Line 9, Col 8, "Duplicate method. The method '.ctor' has the same name and signature as another method in type 'Foo<'a>' once tuples, functions, units of measure and/or provided types are erased.") + ] + + [] + let ``E_Polymorphism01_fsx`` compilation = + compilation + |> getCompilation + |> shouldFailWithDiagnostics [ + (Error 366, Line 12, Col 13, Line 12, Col 25, "No implementation was given for 'abstract Unit.Factor: unit -> float'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") + ] diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 812833e988c..df531ac0058 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -129,10 +129,15 @@ - - - - + + + + + + + + + diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index 9cda28613dd..414b6e9714d 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -1629,7 +1629,8 @@ Actual: (sourceErrors, expectedErrors) ||> List.iter2 (fun actual expected -> - Assert.Equal(expected, actual)) + try Assert.Equal(expected, actual) + with | _ -> failwith $"%s{what}:\nactual:\n %s{actual}\nexpected:\n %s{expected}") let adjust (adjust: int) (result: CompilationResult) : CompilationResult = match result with diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Calculus.fs b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Calculus.fs deleted file mode 100644 index 0263135fc55..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Calculus.fs +++ /dev/null @@ -1,31 +0,0 @@ -// #Conformance #UnitsOfMeasure -#light - -let diff (h:float<_>) (f :_ -> float<_>) = fun x -> (f (x+h) - f (x-h)) / (2.0*h) - -let integrate (f:float<_> -> float<_>) (a:float<_>) (b:float<_>) n = - let h = (b-a) / (float n) - let rec iter x i = - if i=0 then 0.0<_> - else f x + iter (x+h) (i-1) - h * (f a / 2.0 + iter (a+h) (n-1) + f b / 2.0) - -let rec newton (f:float<_> -> float<_>) f' x xacc = - let dx = f x / f' x - let x' = x - dx - if abs dx / x' < xacc - then x' - else newton f f' x' xacc - -// Non-regular datatype: a list of derivatives of a function -type derivs<[] 'u, [] 'v> = - Nil -| Cons of (float<'u> -> float<'v>) * derivs<'u,'v/'u> - -// Essential use of polymorphic recursion! -// Given a step h, function f, and integer n, compute a list of n derivatives -// [f; f'; f''; ...] -// where f is the function itself, f' is the first derivative, f'' is the second, etc. - -let rec makeDerivs<[] 'u, [] 'v> (h:float<'u>, f:float<'u> -> float<'v>, n:int) : derivs<'u,'v> = - if n=0 then Nil else Cons(f, makeDerivs(h, diff h f, n-1)) diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Misc01.fs b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Misc01.fs deleted file mode 100644 index a48edb12d9d..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Misc01.fs +++ /dev/null @@ -1,9 +0,0 @@ -// #Regression #Conformance #UnitsOfMeasure -// Regression test for FSHARP1.0:2869 -#light - -// Polymorphic recursion -let rec prodlists<[] 'u,[] 'v>(xs:float<'u> list,ys:float<'v> list) : float<'u 'v> list = - match xs,ys with - | x::xs,y::ys -> x*y :: prodlists<'v,'u>(ys,xs) - | _ -> [] diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Misc03.fs b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Misc03.fs deleted file mode 100644 index 4f6b5a4429b..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Misc03.fs +++ /dev/null @@ -1,25 +0,0 @@ -// #Conformance #UnitsOfMeasure -let recip1 x = 1.0/x -let recip2 (x:float<_>) = 1.0/x - -let zero1 = 0.0 -let zero2 = 0.0<_> - -let halvelist0 xs = List.map ( (/) 2.0 : float -> float ) xs -let halvelist1 xs = List.map ( (/) 2.0 : float<_> -> float<_> ) xs -let halvelist2 (xs:float<_> list) = List.map ( (/) 2.0) xs -let halvelist3 xs = List.map ( (/) 2.0) xs - -let pr x y = printf "%f %s" x y -let pr2 (x:float<_>) = printf "%f" x - -// From thesis -let abs x = if x < 0.0<_> then 0.0<_> - x else x -let sqr (x:float<_>) = x*x -let cube x = x*sqr x -let powers x y z = sqr x + cube y + sqr z * cube z - -// Now let's test some explicit types -let sqr2< [] 'u>(x:float<'u>) = x*x -let cube2<[] 'v>(x) = sqr2<'v> x * x -let rec reccube1(x) = if x < 0.0<_> then x else - reccube1(x) diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/RationalExponents01.fs b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/RationalExponents01.fs deleted file mode 100644 index 79c649e564e..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/RationalExponents01.fs +++ /dev/null @@ -1,35 +0,0 @@ -// #Conformance #UnitsOfMeasure -// Rational exponents feature - -[] -type kg - -[] -type s - -[] -type m - -// Simple fractions -let test01() = 1.0 -let test02() = 2.0 -let test03() = sqrt (test01()) + test02() - -// Negative fractions -let test04() = 4.0 -let test05() = 5.0 -let test06() = 1.0 / (test04() * test05()) + 3.0 - -// More complex expressions -let test07() = 2.0 -let test08() = 4.0<(s^6 kg^3)^(1/4)> -let test09() = test07() * test08() + 3.0 - -// Generics -let test10(x:float<'u>) (y:float<'u^(1/2)>) = sqrt x + y -let test11(x:float<'u^-(1/4)>) (y:float<'u^(3/4)>) : float = (x*x*x + 1.0/y) * x -let test12(x:float<'u^(1/2)>) (y:float<'v^2>) :float<'u 'v> = x*x*sqrt y -let test13() = test12 4.0 2.0 + 3.0<(kg s)^(1/2)> - -exit 0 - diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/SI.fs b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/SI.fs deleted file mode 100644 index 582f849d974..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/SI.fs +++ /dev/null @@ -1,32 +0,0 @@ -// #Conformance #UnitsOfMeasure -#light - -[] type kg // kilogram -[] type m // metre -[] type s // second -[] type A // ampere -[] type mol // mole -[] type K // kelvin -[] type cd // candela - -[] type rad = m/m // radian -[] type sr = m^2/m^2 // steradian -[] type Hz = s^-1 // hertz -[] type N = kg m / s^2 // newton -[] type Pa = N / m^2 // pascal -[] type J = N m // joule -[] type W = J / s // watt -[] type C = s A // coulomb -[] type V = W/A // watt -[] type F = C/V // farad -[] type ohm = V/A // ohm -[] type S = A/V // siemens -[] type Wb = V s // weber -[] type T = Wb/m^2 // tesla -[] type H = Wb/A // henry -[] type lm = cd sr // lumen -[] type lx = lm/m^2 // lux -[] type Bq = s^-1 // becquerel -[] type Gy = J/kg // gray -[] type Sv = J/kg // sievert -[] type kat = mol/s // katal diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Stats.fs b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Stats.fs deleted file mode 100644 index 8bdb04c9dc1..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/Stats.fs +++ /dev/null @@ -1,32 +0,0 @@ -// #Conformance #UnitsOfMeasure -#light - -let rec sum xs = match xs with [] -> 0.0<_> | (x::xs) -> x + sum xs - -let rec sumMap f xs = match xs with [] -> 0.0<_> | (x::xs) -> f x + sumMap f xs -let rec sumMap2 f xs ys = match xs,ys with (x::xs,y::ys) -> f x y + sumMap2 f xs ys | _ -> 0.0<_> - -let mean xs = sum xs / float (List.length xs) - -let meanMap f xs = sumMap f xs / float (List.length xs) - -let sqr (x:float<_>) = x*x - -let cube x = x*sqr x - -let variance xs = let m = mean xs in meanMap (fun x -> sqr (x-m)) xs -let sdeviation xs = sqrt (variance xs) - -let skewness xs = - let n = float (List.length xs) - let m = mean xs - let s = sdeviation xs - meanMap (fun x -> cube(x-m)) xs / (cube s) - -let covariance xs ys = - let m = mean xs - let n = mean ys - sumMap2 (fun x y -> (x-m)*(y-n)) xs ys / (float n) - -let correlation xs ys = - covariance xs ys / (mean xs * mean ys) diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/env.lst b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/env.lst deleted file mode 100644 index 378c1aa2247..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Basic/env.lst +++ /dev/null @@ -1,18 +0,0 @@ - SOURCE=Calculus.fs COMPILE_ONLY=1 # Calculus.fs - - SOURCE=Mars.fs # Mars.fs - - SOURCE=MassForce.fs # MassForce.fs - SOURCE=E_MassForce.fs SCFLAGS="--test:ErrorRanges" # E_MassForce.fs - - SOURCE=Ints01.fs # Ints01.fs - - SOURCE=Misc02.fs # Misc02.fs - SOURCE=Misc04.fs # Misc04.fs - - - - - SOURCE=DynamicTypeTest.fs # DynamicTypeTest.fs - SOURCE=OnDecimals01.fs # OnDecimals01.fs - diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Bounds/env.lst b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Bounds/env.lst deleted file mode 100644 index ea51d725c9e..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Bounds/env.lst +++ /dev/null @@ -1,2 +0,0 @@ - SOURCE=infinity_01.fs SCFLAGS="--test:ErrorRanges" # infinity_01.fs - SOURCE=nan_01.fs SCFLAGS="--test:ErrorRanges" # nan_01.fs diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/env.lst b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/env.lst deleted file mode 100644 index 10221fc0251..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Constants/env.lst +++ /dev/null @@ -1,8 +0,0 @@ - SOURCE=decimal.fs SCFLAGS=-a # decimal.fs - SOURCE=E_UnsupportedTypes01.fs SCFLAGS=-a # E_UnsupportedTypes01.fs - SOURCE=ieee32.fs SCFLAGS=-a # ieee32.fs - SOURCE=ieee64.fs SCFLAGS=-a # ieee64.fs - SOURCE=SpecialSyntax_.fs SCFLAGS=-a # SpecialSyntax_.fs - - - diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/env.lst b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/env.lst deleted file mode 100644 index 8b92be2e707..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Diagnostics/env.lst +++ /dev/null @@ -1,29 +0,0 @@ - SOURCE=E_RangeExpression01.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_RangeExpression01.fs - - SOURCE=W_NonGenVarInValueRestrictionWarning.fs SCFLAGS="--test:ErrorRanges --flaterrors" # W_NonGenVarInValueRestrictionWarning.fs - SOURCE=E_CantBeUsedAsPrefixArgToAType01.fsx SCFLAGS="--test:ErrorRanges" # E_CantBeUsedAsPrefixArgToAType01.fsx - SOURCE=E_CantBeUsedAsPrefixArgToAType02.fsx SCFLAGS="--test:ErrorRanges" # E_CantBeUsedAsPrefixArgToAType02.fsx - SOURCE=E_CantBeUsedAsPrefixArgToAType03.fsx SCFLAGS="--test:ErrorRanges" # E_CantBeUsedAsPrefixArgToAType03.fsx - SOURCE=E_CantBeUsedAsPrefixArgToAType04.fsx SCFLAGS="--test:ErrorRanges" # E_CantBeUsedAsPrefixArgToAType04.fsx - SOURCE=E_CantBeUsedAsPrefixArgToAType05.fsx SCFLAGS="--test:ErrorRanges" # E_CantBeUsedAsPrefixArgToAType05.fsx - - SOURCE=E_UnexpectedTypeParameter01.fs SCFLAGS="--test:ErrorRanges" # E_UnexpectedTypeParameter01.fs - SOURCE=E_ZeroDenominator.fs SCFLAGS="--test:ErrorRanges" # E_ZeroDenominator.fs - SOURCE=E_ParsingRationalExponents.fs SCFLAGS="--test:ErrorRanges" # E_ParsingRationalExponents.fs - - SOURCE=W_UnitOfMeasureCodeLessGeneric01.fs SCFLAGS="--test:ErrorRanges -a" # W_UnitOfMeasureCodeLessGeneric01.fs - - SOURCE=E_ExplicitUnitOfMeasureParameters01.fs SCFLAGS="--test:ErrorRanges" # E_ExplicitUnitOfMeasureParameters01.fs - SOURCE=E_ExplicitUnitOfMeasureParameters02.fs SCFLAGS="--test:ErrorRanges" # E_ExplicitUnitOfMeasureParameters02.fs - SOURCE=E_ExplicitUnitOfMeasureParameters03.fs SCFLAGS="--test:ErrorRanges" # E_ExplicitUnitOfMeasureParameters03.fs - SOURCE=E_ExplicitUnitOfMeasureParameters04.fs SCFLAGS="--test:ErrorRanges" # E_ExplicitUnitOfMeasureParameters04.fs - - SOURCE=E_RangeOfDimensioned03.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_RangeOfDimensioned03.fs - SOURCE=RangeOfDimensioned01.fs SCFLAGS="--test:ErrorRanges" # RangeOfDimensioned01.fs - SOURCE=RangeOfDimensioned02.fs SCFLAGS="--test:ErrorRanges" # RangeOfDimensioned02.fs - - SOURCE=E_ExpectedTypeNotUnitOfMeasure01.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_ExpectedTypeNotUnitOfMeasure01.fs - SOURCE=E_UnsupportedType01.fs SCFLAGS="--test:ErrorRanges" # E_UnsupportedType01.fs - SOURCE=E_RangeOfDecimals01.fs SCFLAGS="--test:ErrorRanges" # E_RangeOfDecimals01.fs - - SOURCE=IntTypes01.fs SCFLAGS="--test:ErrorRanges -a" # IntTypes01.fs diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Operators/env.lst b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Operators/env.lst deleted file mode 100644 index 30b2960759c..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Operators/env.lst +++ /dev/null @@ -1,7 +0,0 @@ - SOURCE=Operators_decimal_01.fs SCFLAGS=-a # Operators_decimal_01.fs - SOURCE=Operators_float32_01.fs SCFLAGS=-a # Operators_float32_01.fs - SOURCE=Operators_float_01.fs SCFLAGS=-a # Operators_float_01.fs - - - - diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/env.lst b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/env.lst deleted file mode 100644 index 07058de7ec7..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parenthesis/env.lst +++ /dev/null @@ -1,13 +0,0 @@ -SOURCE=Positive01.fs SCFLAGS="--test:ErrorRanges -a" # Positive01.fs - -SOURCE=W_ImplicitProduct01.fs SCFLAGS="--test:ErrorRanges" # W_ImplicitProduct01.fs - -SOURCE=E_Error02.fs SCFLAGS="--test:ErrorRanges" # E_Error02.fs -SOURCE=E_Error03.fs SCFLAGS="--test:ErrorRanges" # E_Error03.fs -SOURCE=E_Error04.fs SCFLAGS="--test:ErrorRanges" # E_Error04.fs -SOURCE=E_Error05.fs SCFLAGS="--test:ErrorRanges" # E_Error05.fs -SOURCE=E_Error06.fs SCFLAGS="--test:ErrorRanges" # E_Error06.fs - -SOURCE=E_IncompleteParens01.fs SCFLAGS="--test:ErrorRanges" # E_IncompleteParens01.fs -SOURCE=E_IncompleteParens02.fs SCFLAGS="--test:ErrorRanges" # E_IncompleteParens02.fs - diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/GreaterBarRBrack01.fs b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/GreaterBarRBrack01.fs deleted file mode 100644 index dced37284cd..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/GreaterBarRBrack01.fs +++ /dev/null @@ -1,18 +0,0 @@ -// #Regression #Conformance #UnitsOfMeasure -// Regression test for FSHARP1.0:2791 -// Make sure we can parse arrays of dimensioned numbers without needing a space between > and |] -// -#light - -[] -type m - -let l1 = [|10.0|] // ok -let l2 = [|10.0 |] // ok - -// This was not really specific to Units of Measure, we while we are here -// we check that care too. -let p1 = [|Array.empty|] // ok -let p2 = [|Array.empty |] // ok - -exit 0 diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/KnownTypeAsUnit01.fs b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/KnownTypeAsUnit01.fs deleted file mode 100644 index 57dee6b46b4..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/KnownTypeAsUnit01.fs +++ /dev/null @@ -1,25 +0,0 @@ -// #Regression #Conformance #UnitsOfMeasure -// Regression test for FSHARP1.0:2708 -// ICE when using a known type (int, decimal, etc...) as a unit of measure -//Expected unit-of-measure, not type -//Expected unit-of-measure, not type -//Expected unit-of-measure, not type -//Expected unit-of-measure, not type -//Expected unit-of-measure, not type -[] type Kg - -module M1 = - 1.0 // error - -module M2 = - let x = 1.0 // error - -module M3 = - let f2 ( x : float) = x // error - -module M4 = - let f4 (x : 'a when 'a :> float) = x // error - -module M5 = - type T<[] 'a>(x : float, y : float<_>) = class end // error - diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/Quotient.fs b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/Quotient.fs deleted file mode 100644 index 4c8458ed935..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/Quotient.fs +++ /dev/null @@ -1,19 +0,0 @@ -// #Regression #Conformance #UnitsOfMeasure -// Regression test for FSHARP1.0:6157 - Units of measure containing "/" get rejected in arguments to method invocation - -[] type m -[] type s - -let sqr<[] 'u>(x:float<'u>) = x*x - -type T() = - member this.sqr<[] 'u>(x:float<'u>) = x*x - - -let t = new T() -let a = sqr(5.0) -let b = sqr(2.0) -let c = sqr(3.0) -let d = t.sqr(5.0) -let e = t.sqr(2.0) -let f = t.sqr(3.0) diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/QuotientAssoc.fs b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/QuotientAssoc.fs deleted file mode 100644 index fe3aecf7e94..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/QuotientAssoc.fs +++ /dev/null @@ -1,24 +0,0 @@ -// #Regression #Conformance #UnitsOfMeasure -// Regression test for FSHARP1.0:4124 - Units of measure: division should be left-associative in both types and constants -// Regression test for FSHARP1.0:4188 - Type parameters for units of measure parsed inconsistently. - -#light - -[] type s -[] type m -[] type A = m / s / s -[] type AA = m / s^2 -[] type B = m^2 / m s / s^2 / s^-1 -[] type B' = m / s / s / s / s / s / s / s / s^-5 -[] type C = m / s * s / s * s / s / s - -let (x : float) = 1.0 -let y = 2.0 -let z = x+y -let a = 1.0 -let aa = 2.0 -let (b : float) = 3.0 -let b' = 4.0 -let (c : float) = 5.0 - -let res = a + aa + b + b' + c diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/Reciprocal01.fs b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/Reciprocal01.fs deleted file mode 100644 index dcac1cb1c50..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/Reciprocal01.fs +++ /dev/null @@ -1,17 +0,0 @@ -// #Regression #Conformance #UnitsOfMeasure -// Regression test for FSHARP1.0:2748 -// Units or measures: we should not require a space between < and \ when using a reciprocal of a unit - -// Regression test for FSHARP1.0:4195 -// Reciprocals parsed incorrectly for Measure definitions. - -#light - -[] type s // [] type s -[] type s' = / s / s // [] type s' = /s ^ 2 -let oneHertz = 1.0 // OK -let twoHertz = 2.0f< /s> // OK - -if (1.0 + 2.0 <> 3.0) then exit 1 - -exit 0 diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/env.lst b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/env.lst deleted file mode 100644 index fcc63fee947..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/Parsing/env.lst +++ /dev/null @@ -1,4 +0,0 @@ - SOURCE=KnownTypeAsUnit01.fs SCFLAGS="--test:ErrorRanges" # KnownTypeAsUnit01.fs - SOURCE=KnownTypeAsUnit01b.fs SCFLAGS="--test:ErrorRanges" # KnownTypeAsUnit01b.fs - SOURCE=E_Nesting01.fs SCFLAGS="--test:ErrorRanges" # E_Nesting01.fs.fs -NoMT SOURCE=find_gtdef.fsx FSIMODE=EXEC COMPILE_ONLY=1 # find_gtdef.fsx diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/env.lst b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/env.lst deleted file mode 100644 index caf239bf3f8..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/env.lst +++ /dev/null @@ -1,19 +0,0 @@ - - SOURCE=Slash_InFunction01.fs SCFLAGS=--warnaserror+ # Slash_InFunction01.fs - SOURCE=Slash_InMethod01.fs SCFLAGS=--warnaserror+ # Slash_InMethod01.fs - - SOURCE=Generalization01.fs SCFLAGS=--warnaserror # Generalization01.fs - - SOURCE=E_GenInterfaceWithDifferentGenInstantiations.fs SCFLAGS="--test:ErrorRanges --langversion:5.0" # E_GenInterfaceWithDifferentGenInstantiations.fs - - SOURCE=TypeAbbreviation_decimal_01.fs # TypeAbbreviation_decimal_01.fs - SOURCE=TypeAbbreviation_float32_01.fs # TypeAbbreviation_float32_01.fs - SOURCE=TypeAbbreviation_float_01.fs # TypeAbbreviation_float_01.fs - - SOURCE=typechecker01.fs SCFLAGS="--test:ErrorRanges" # typechecker01.fs - SOURCE=W_TypeConstraint01.fs SCFLAGS="--test:ErrorRanges" # W_TypeConstraint01.fs - SOURCE=TypeConstraint02.fs # TypeConstraint02.fs - SOURCE=TypeConstraint03.fs # TypeConstraint03.fs -NoMT SOURCE=W_LessGeneric01.fsx COMPILE_ONLY=1 SCFLAGS="--nologo" FSIMODE=PIPE # W_LessGeneric01.fsx - SOURCE=LessGeneric02.fs # LessGeneric02.fs - SOURCE=ValueRestriction01.fs # ValueRestriction01.fs diff --git a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/env.lst b/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/env.lst deleted file mode 100644 index d30059c87fe..00000000000 --- a/tests/fsharpqa/Source/Conformance/UnitsOfMeasure/WithOOP/env.lst +++ /dev/null @@ -1,10 +0,0 @@ - SOURCE=InInterface01.fs # InInterface01.fs - SOURCE=E_NoInstanceOnMeasure01.fs SCFFLAGS="--test:ErrorRanges" # E_NoInstanceOnMeasure01.fs - SOURCE=StaticsOnMeasure01.fs # StaticsOnMeasure01.fs - SOURCE=E_OverloadsDifferByUOMAttr.fs SCFFLAGS="--test:ErrorRanges" # E_OverloadsDifferByUOMAttr.fs - SOURCE=GenericUOM01.fs # GenericUOM01.fs -NoMT SOURCE=E_Polymorphism01.fsx FSIMODE=PIPE SCFLAGS="--test:ErrorRanges" COMPILE_ONLY=1 # E_Polymorphism01.fsx - SOURCE=Polymorphism02.fs # Polymorphism02.fs - SOURCE=E_NoConstructorOnMeasure01.fs SCFLAGS="--test:ErrorRanges" # E_NoConstructorOnMeasure01.fs - SOURCE=E_GenericUOM01.fs # E_GenericUOM01.fs - diff --git a/tests/fsharpqa/Source/test.lst b/tests/fsharpqa/Source/test.lst index 31b787ef41e..f0ae0203c87 100644 --- a/tests/fsharpqa/Source/test.lst +++ b/tests/fsharpqa/Source/test.lst @@ -140,16 +140,6 @@ Conformance08 Conformance\TypesAndTypeConstraints\LogicalPropertiesOfTypes Conformance08 Conformance\TypesAndTypeConstraints\TypeConstraints Conformance08 Conformance\TypesAndTypeConstraints\TypeParameterDefinitions -Conformance08 Conformance\UnitsOfMeasure\Basic -Conformance08 Conformance\UnitsOfMeasure\Bounds -Conformance08 Conformance\UnitsOfMeasure\Constants -Conformance08 Conformance\UnitsOfMeasure\Diagnostics -Conformance08 Conformance\UnitsOfMeasure\Operators -Conformance08 Conformance\UnitsOfMeasure\Parenthesis -Conformance08 Conformance\UnitsOfMeasure\Parsing -Conformance08 Conformance\UnitsOfMeasure\TypeChecker -Conformance08 Conformance\UnitsOfMeasure\WithOOP - Misc01 Diagnostics\async Misc01,Diagnostics Diagnostics\General Misc01 Diagnostics\NONTERM