From dc0e0ba6f5c26be6f5102a28a9e40ea2cc4654ec Mon Sep 17 00:00:00 2001 From: Sergey Tihon Date: Sat, 13 Jul 2019 20:54:01 +0300 Subject: [PATCH 1/5] Moving AccessOfTypeAbbreviationTests over to NUnit --- .../AccessOfTypeAbbreviationTests.fs | 87 +++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 1 + .../Warnings/AccessOfTypeAbbreviation.fs | 8 -- .../Warnings/AccessOfTypeAbbreviation2.fs | 8 -- .../Warnings/AccessOfTypeAbbreviation3.fs | 8 -- .../Warnings/AccessOfTypeAbbreviation4.fs | 8 -- .../Warnings/AccessOfTypeAbbreviation5.fs | 8 -- .../Warnings/AccessOfTypeAbbreviation6.fs | 8 -- tests/fsharpqa/Source/Warnings/env.lst | 6 -- 9 files changed, 88 insertions(+), 54 deletions(-) create mode 100644 tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs delete mode 100644 tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation.fs delete mode 100644 tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation2.fs delete mode 100644 tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation3.fs delete mode 100644 tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation4.fs delete mode 100644 tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation5.fs delete mode 100644 tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation6.fs diff --git a/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs b/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs new file mode 100644 index 00000000000..21ad6753fae --- /dev/null +++ b/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ``Access Of Type Abbreviation`` = + + [] + let ``Test``() = + CompilerAssert.TypeCheckSingleError + """ +module Library = + type private Hidden = Hidden of unit + type Exported = Hidden + +exit 0 + """ + FSharpErrorSeverity.Warning + 1 + (2, 8, 2, 15) + "The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in" + + [] + let ``Test2``() = + CompilerAssert.Pass + """ +module Library = + type internal Hidden = Hidden of unit + type internal Exported = Hidden + +exit 0 + """ + + [] + let ``Test3``() = + CompilerAssert.TypeCheckSingleError + """ +module Library = + type internal Hidden = Hidden of unit + type Exported = Hidden + +exit 0 + """ + FSharpErrorSeverity.Warning + 1 + (2, 8, 2, 15) + "The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in" + + [] + let ``Test4``() = + CompilerAssert.TypeCheckSingleError + """ +module Library = + type private Hidden = Hidden of unit + type internal Exported = Hidden + +exit 0 + """ + FSharpErrorSeverity.Warning + 1 + (2, 8, 2, 15) + "The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in" + + [] + let ``Test5``() = + CompilerAssert.Pass + """ +module Library = + type private Hidden = Hidden of unit + type private Exported = Hidden + +exit 0 + """ + + [] + let ``Test6``() = + CompilerAssert.Pass + """ +module Library = + type Hidden = Hidden of unit + type Exported = Hidden + +exit 0 + """ \ No newline at end of file diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 6335b5172cd..370c6e6fb44 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -32,6 +32,7 @@ + diff --git a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation.fs b/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation.fs deleted file mode 100644 index b72fdb7baae..00000000000 --- a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation.fs +++ /dev/null @@ -1,8 +0,0 @@ -// #Warnings -//The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in - -module Library = - type private Hidden = Hidden of unit - type Exported = Hidden - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation2.fs b/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation2.fs deleted file mode 100644 index 898e941523e..00000000000 --- a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation2.fs +++ /dev/null @@ -1,8 +0,0 @@ -// #Warnings -// - -module Library = - type internal Hidden = Hidden of unit - type internal Exported = Hidden - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation3.fs b/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation3.fs deleted file mode 100644 index de1875bf576..00000000000 --- a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation3.fs +++ /dev/null @@ -1,8 +0,0 @@ -// #Warnings -//The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in - -module Library = - type internal Hidden = Hidden of unit - type Exported = Hidden - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation4.fs b/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation4.fs deleted file mode 100644 index 728dc399bf2..00000000000 --- a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation4.fs +++ /dev/null @@ -1,8 +0,0 @@ -// #Warnings -//The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in - -module Library = - type private Hidden = Hidden of unit - type internal Exported = Hidden - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation5.fs b/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation5.fs deleted file mode 100644 index d0d3b251008..00000000000 --- a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation5.fs +++ /dev/null @@ -1,8 +0,0 @@ -// #Warnings -// - -module Library = - type private Hidden = Hidden of unit - type private Exported = Hidden - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation6.fs b/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation6.fs deleted file mode 100644 index d179e5f20e0..00000000000 --- a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation6.fs +++ /dev/null @@ -1,8 +0,0 @@ -// #Warnings -// - -module Library = - type Hidden = Hidden of unit - type Exported = Hidden - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/env.lst b/tests/fsharpqa/Source/Warnings/env.lst index 127d78a21c5..b18638955a9 100644 --- a/tests/fsharpqa/Source/Warnings/env.lst +++ b/tests/fsharpqa/Source/Warnings/env.lst @@ -16,12 +16,6 @@ SOURCE=WrongArity.fs # WrongArity.fs SOURCE=OverrideErrors.fs # OverrideErrors.fs SOURCE=MethodIsNotStatic.fs # MethodIsNotStatic.fs - SOURCE=AccessOfTypeAbbreviation.fs # AccessOfTypeAbbreviation.fs - SOURCE=AccessOfTypeAbbreviation2.fs # AccessOfTypeAbbreviation2.fs - SOURCE=AccessOfTypeAbbreviation3.fs # AccessOfTypeAbbreviation3.fs - SOURCE=AccessOfTypeAbbreviation4.fs # AccessOfTypeAbbreviation4.fs - SOURCE=AccessOfTypeAbbreviation5.fs # AccessOfTypeAbbreviation5.fs - SOURCE=AccessOfTypeAbbreviation6.fs # AccessOfTypeAbbreviation6.fs SOURCE=EqualsInsteadOfInInForLoop.fs # EqualsInsteadOfInInForLoop.fs SOURCE=DontWarnExternalFunctionAsUnused.fs SCFLAGS="--warnon:1182 --warnaserror+" # DontWarnExternalFunctionAsUnused.fs SOURCE=SuggestTypesInModule.fs # SuggestTypesInModule.fs From 7f8b3c92418402e05aa9d428ee34e03e4c0bccc6 Mon Sep 17 00:00:00 2001 From: Sergey Tihon Date: Sat, 13 Jul 2019 21:47:10 +0300 Subject: [PATCH 2/5] ha! now I know what this `1` means =) --- .../Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs b/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs index 21ad6753fae..68ef94335d9 100644 --- a/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs +++ b/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs @@ -19,7 +19,7 @@ module Library = exit 0 """ FSharpErrorSeverity.Warning - 1 + 44 (2, 8, 2, 15) "The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in" @@ -45,7 +45,7 @@ module Library = exit 0 """ FSharpErrorSeverity.Warning - 1 + 44 (2, 8, 2, 15) "The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in" @@ -60,7 +60,7 @@ module Library = exit 0 """ FSharpErrorSeverity.Warning - 1 + 44 (2, 8, 2, 15) "The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in" From aac39d34c79a095314cb2c966507d81b31769ba7 Mon Sep 17 00:00:00 2001 From: Sergey Tihon Date: Sat, 13 Jul 2019 22:34:47 +0300 Subject: [PATCH 3/5] Error range updated and removed `exit 0` --- .../AccessOfTypeAbbreviationTests.fs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs b/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs index 68ef94335d9..349b02f1a11 100644 --- a/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs +++ b/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs @@ -15,12 +15,10 @@ module ``Access Of Type Abbreviation`` = module Library = type private Hidden = Hidden of unit type Exported = Hidden - -exit 0 """ FSharpErrorSeverity.Warning 44 - (2, 8, 2, 15) + (4, 8, 4, 16) "The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in" [] @@ -30,8 +28,6 @@ exit 0 module Library = type internal Hidden = Hidden of unit type internal Exported = Hidden - -exit 0 """ [] @@ -41,12 +37,10 @@ exit 0 module Library = type internal Hidden = Hidden of unit type Exported = Hidden - -exit 0 """ FSharpErrorSeverity.Warning 44 - (2, 8, 2, 15) + (4, 8, 4, 16) "The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in" [] @@ -56,12 +50,10 @@ exit 0 module Library = type private Hidden = Hidden of unit type internal Exported = Hidden - -exit 0 """ FSharpErrorSeverity.Warning 44 - (2, 8, 2, 15) + (4, 8, 4, 16) "The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in" [] @@ -71,8 +63,6 @@ exit 0 module Library = type private Hidden = Hidden of unit type private Exported = Hidden - -exit 0 """ [] @@ -82,6 +72,4 @@ exit 0 module Library = type Hidden = Hidden of unit type Exported = Hidden - -exit 0 """ \ No newline at end of file From efc2c610fc63c6e5da2ea400b71e141bb1630510 Mon Sep 17 00:00:00 2001 From: Sergey Tihon Date: Sat, 13 Jul 2019 23:28:03 +0300 Subject: [PATCH 4/5] Error message prefixed by "This construct is deprecated." --- .../ErrorMessages/AccessOfTypeAbbreviationTests.fs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs b/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs index 349b02f1a11..ab6b73c6ae1 100644 --- a/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs +++ b/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs @@ -19,7 +19,7 @@ module Library = FSharpErrorSeverity.Warning 44 (4, 8, 4, 16) - "The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in" + "This construct is deprecated. The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in" [] let ``Test2``() = @@ -41,7 +41,7 @@ module Library = FSharpErrorSeverity.Warning 44 (4, 8, 4, 16) - "The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in" + "This construct is deprecated. The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in" [] let ``Test4``() = @@ -53,8 +53,8 @@ module Library = """ FSharpErrorSeverity.Warning 44 - (4, 8, 4, 16) - "The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in" + (4, 17, 4, 25) + "This construct is deprecated. The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in" [] let ``Test5``() = From d586e7a6c965a0983e6b30863003e0655faf866e Mon Sep 17 00:00:00 2001 From: Sergey Tihon Date: Sun, 14 Jul 2019 00:31:31 +0300 Subject: [PATCH 5/5] Error messages changed based on current state of FSI --- .../ErrorMessages/AccessOfTypeAbbreviationTests.fs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs b/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs index ab6b73c6ae1..0143486a349 100644 --- a/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs +++ b/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs @@ -9,7 +9,7 @@ open FSharp.Compiler.SourceCodeServices module ``Access Of Type Abbreviation`` = [] - let ``Test``() = + let ``Test1``() = CompilerAssert.TypeCheckSingleError """ module Library = @@ -19,7 +19,7 @@ module Library = FSharpErrorSeverity.Warning 44 (4, 8, 4, 16) - "This construct is deprecated. The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in" + "This construct is deprecated. The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in.\r\nAs of F# 4.1, the accessibility of type abbreviations is checked at compile-time. Consider changing the accessibility of the type abbreviation. Ignoring this warning might lead to runtime errors." [] let ``Test2``() = @@ -41,7 +41,7 @@ module Library = FSharpErrorSeverity.Warning 44 (4, 8, 4, 16) - "This construct is deprecated. The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in" + "This construct is deprecated. The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in.\r\nAs of F# 4.1, the accessibility of type abbreviations is checked at compile-time. Consider changing the accessibility of the type abbreviation. Ignoring this warning might lead to runtime errors." [] let ``Test4``() = @@ -54,7 +54,7 @@ module Library = FSharpErrorSeverity.Warning 44 (4, 17, 4, 25) - "This construct is deprecated. The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in" + "This construct is deprecated. The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in.\r\nAs of F# 4.1, the accessibility of type abbreviations is checked at compile-time. Consider changing the accessibility of the type abbreviation. Ignoring this warning might lead to runtime errors." [] let ``Test5``() =