Skip to content

Commit c4dba1f

Browse files
sergey-tihonKevinRansom
authored andcommitted
Moving AccessOfTypeAbbreviationTests over to NUnit (#7226)
* Moving AccessOfTypeAbbreviationTests over to NUnit * ha! now I know what this `1` means =) * Error range updated and removed `exit 0` * Error message prefixed by "This construct is deprecated." * Error messages changed based on current state of FSI
1 parent ec8a424 commit c4dba1f

File tree

9 files changed

+76
-54
lines changed

9 files changed

+76
-54
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
2+
3+
namespace FSharp.Compiler.UnitTests
4+
5+
open NUnit.Framework
6+
open FSharp.Compiler.SourceCodeServices
7+
8+
[<TestFixture>]
9+
module ``Access Of Type Abbreviation`` =
10+
11+
[<Test>]
12+
let ``Test1``() =
13+
CompilerAssert.TypeCheckSingleError
14+
"""
15+
module Library =
16+
type private Hidden = Hidden of unit
17+
type Exported = Hidden
18+
"""
19+
FSharpErrorSeverity.Warning
20+
44
21+
(4, 8, 4, 16)
22+
"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."
23+
24+
[<Test>]
25+
let ``Test2``() =
26+
CompilerAssert.Pass
27+
"""
28+
module Library =
29+
type internal Hidden = Hidden of unit
30+
type internal Exported = Hidden
31+
"""
32+
33+
[<Test>]
34+
let ``Test3``() =
35+
CompilerAssert.TypeCheckSingleError
36+
"""
37+
module Library =
38+
type internal Hidden = Hidden of unit
39+
type Exported = Hidden
40+
"""
41+
FSharpErrorSeverity.Warning
42+
44
43+
(4, 8, 4, 16)
44+
"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."
45+
46+
[<Test>]
47+
let ``Test4``() =
48+
CompilerAssert.TypeCheckSingleError
49+
"""
50+
module Library =
51+
type private Hidden = Hidden of unit
52+
type internal Exported = Hidden
53+
"""
54+
FSharpErrorSeverity.Warning
55+
44
56+
(4, 17, 4, 25)
57+
"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."
58+
59+
[<Test>]
60+
let ``Test5``() =
61+
CompilerAssert.Pass
62+
"""
63+
module Library =
64+
type private Hidden = Hidden of unit
65+
type private Exported = Hidden
66+
"""
67+
68+
[<Test>]
69+
let ``Test6``() =
70+
CompilerAssert.Pass
71+
"""
72+
module Library =
73+
type Hidden = Hidden of unit
74+
type Exported = Hidden
75+
"""

tests/fsharp/FSharpSuite.Tests.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<Compile Include="tests.fs" />
3333
<Compile Include="Compiler\ILChecker.fs" />
3434
<Compile Include="Compiler\CompilerAssert.fs" />
35+
<Compile Include="Compiler\ErrorMessages\AccessOfTypeAbbreviationTests.fs" />
3536
<Compile Include="Compiler\ErrorMessages\ElseBranchHasWrongTypeTests.fs" />
3637
<Compile Include="Compiler\ErrorMessages\MissingElseBranch.fs" />
3738
<Compile Include="Compiler\SourceTextTests.fs" />

tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation.fs

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation2.fs

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation3.fs

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation4.fs

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation5.fs

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation6.fs

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/fsharpqa/Source/Warnings/env.lst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313
SOURCE=WrongArity.fs # WrongArity.fs
1414
SOURCE=OverrideErrors.fs # OverrideErrors.fs
1515
SOURCE=MethodIsNotStatic.fs # MethodIsNotStatic.fs
16-
SOURCE=AccessOfTypeAbbreviation.fs # AccessOfTypeAbbreviation.fs
17-
SOURCE=AccessOfTypeAbbreviation2.fs # AccessOfTypeAbbreviation2.fs
18-
SOURCE=AccessOfTypeAbbreviation3.fs # AccessOfTypeAbbreviation3.fs
19-
SOURCE=AccessOfTypeAbbreviation4.fs # AccessOfTypeAbbreviation4.fs
20-
SOURCE=AccessOfTypeAbbreviation5.fs # AccessOfTypeAbbreviation5.fs
21-
SOURCE=AccessOfTypeAbbreviation6.fs # AccessOfTypeAbbreviation6.fs
2216
SOURCE=EqualsInsteadOfInInForLoop.fs # EqualsInsteadOfInInForLoop.fs
2317
SOURCE=DontWarnExternalFunctionAsUnused.fs SCFLAGS="--warnon:1182 --warnaserror+" # DontWarnExternalFunctionAsUnused.fs
2418
SOURCE=SuggestTypesInModule.fs # SuggestTypesInModule.fs

0 commit comments

Comments
 (0)