diff --git a/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs b/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs new file mode 100644 index 00000000000..0143486a349 --- /dev/null +++ b/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs @@ -0,0 +1,75 @@ +// 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 ``Test1``() = + CompilerAssert.TypeCheckSingleError + """ +module Library = + type private Hidden = Hidden of unit + type Exported = Hidden + """ + 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.\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``() = + CompilerAssert.Pass + """ +module Library = + type internal Hidden = Hidden of unit + type internal Exported = Hidden + """ + + [] + let ``Test3``() = + CompilerAssert.TypeCheckSingleError + """ +module Library = + type internal Hidden = Hidden of unit + type Exported = Hidden + """ + 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.\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``() = + CompilerAssert.TypeCheckSingleError + """ +module Library = + type private Hidden = Hidden of unit + type internal Exported = Hidden + """ + 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.\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``() = + CompilerAssert.Pass + """ +module Library = + type private Hidden = Hidden of unit + type private Exported = Hidden + """ + + [] + let ``Test6``() = + CompilerAssert.Pass + """ +module Library = + type Hidden = Hidden of unit + type Exported = Hidden + """ \ 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