You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let``Private type produces warning when trying to export``()=
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."+ System.Environment.NewLine +"As 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
+
[<Fact>]
25
+
let``Internal type passes when abbrev is internal``()=
26
+
CompilerAssert.Pass
27
+
"""
28
+
module Library =
29
+
type internal Hidden = Hidden of unit
30
+
type internal Exported = Hidden
31
+
"""
32
+
33
+
[<Fact>]
34
+
let``Internal type produces warning when trying to export``()=
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."+ System.Environment.NewLine +"As 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
+
[<Fact>]
47
+
let``Private type produces warning when abbrev is internal``()=
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."+ System.Environment.NewLine +"As 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
+
[<Fact>]
60
+
let``Private type passes when abbrev is private``()=
61
+
CompilerAssert.Pass
62
+
"""
63
+
module Library =
64
+
type private Hidden = Hidden of unit
65
+
type private Exported = Hidden
66
+
"""
67
+
68
+
[<Fact>]
69
+
let``Default access type passes when abbrev is default``()=
FSharpErrorSeverity.Error,783,(6,9,6,19),"At least one override did not correctly implement its corresponding abstract member"
28
27
|]
29
28
30
-
[<Test>]
29
+
[<Fact>]
31
30
let``Wrong Arity``()=
32
31
CompilerAssert.TypeCheckSingleError
33
32
"""
@@ -43,7 +42,7 @@ MyType.MyMember("", 0, 0)
43
42
(7,1,7,26)
44
43
"A member or object constructor 'MyMember' taking 3 arguments is not accessible from this code location. All accessible versions of method 'MyMember' take 2 arguments."
45
44
46
-
[<Test>]
45
+
[<Fact>]
47
46
let``Method Is Not Static``()=
48
47
CompilerAssert.TypeCheckSingleError
49
48
"""
@@ -57,7 +56,7 @@ let x = Class1.X()
57
56
(5,9,5,17)
58
57
"Method or object constructor 'X' is not static"
59
58
60
-
[<Test>]
59
+
[<Fact>]
61
60
let``Matching Method With Same Name Is Not Abstract``()=
62
61
CompilerAssert.TypeCheckWithErrors
63
62
"""
@@ -75,7 +74,7 @@ let foo =
75
74
FSharpErrorSeverity.Error,783,(6,11,6,14),"At least one override did not correctly implement its corresponding abstract member"
76
75
|]
77
76
78
-
[<Test>]
77
+
[<Fact>]
79
78
let``No Matching Abstract Method With Same Name``()=
80
79
CompilerAssert.TypeCheckWithErrors
81
80
"""
@@ -89,13 +88,13 @@ let x =
89
88
}
90
89
"""
91
90
[|
92
-
FSharpErrorSeverity.Error,767,(8,14,8,34),"The member 'Function' does not correspond to any abstract or virtual method available to override or implement. Maybe you want one of the following:\r\n MyFunction"
91
+
FSharpErrorSeverity.Error,767,(8,14,8,34),"The member 'Function' does not correspond to any abstract or virtual method available to override or implement. Maybe you want one of the following:"+ System.Environment.NewLine +" MyFunction"
93
92
FSharpErrorSeverity.Error,17,(8,19,8,27),"The member 'Function : 'a * 'b -> unit' does not have the correct type to override any given virtual method"
94
-
FSharpErrorSeverity.Error,366,(7,3,9,4),"No implementation was given for those members: \r\n\t'abstract member IInterface.MyFunction : int32 * int32 -> unit'\r\n\t'abstract member IInterface.SomeOtherFunction : int32 * int32 -> unit'\r\nNote that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'."
93
+
FSharpErrorSeverity.Error,366,(7,3,9,4),"No implementation was given for those members: "+ System.Environment.NewLine +"\t'abstract member IInterface.MyFunction : int32 * int32 -> unit'"+ System.Environment.NewLine +"\t'abstract member IInterface.SomeOtherFunction : int32 * int32 -> unit'"+ System.Environment.NewLine +"Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'."
95
94
FSharpErrorSeverity.Error,783,(7,9,7,19),"At least one override did not correctly implement its corresponding abstract member"
96
95
|]
97
96
98
-
[<Test>]
97
+
[<Fact>]
99
98
let``Member Has Multiple Possible Dispatch Slots``()=
100
99
CompilerAssert.TypeCheckWithErrors
101
100
"""
@@ -108,11 +107,11 @@ type Overload =
108
107
override __.Bar _ = 1
109
108
"""
110
109
[|
111
-
FSharpErrorSeverity.Error,366,(7,15,7,24),"No implementation was given for those members: \r\n\t'abstract member IOverload.Bar : double -> int'\r\n\t'abstract member IOverload.Bar : int -> int'\r\nNote that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'."
112
-
FSharpErrorSeverity.Error,3213,(8,21,8,24),"The member 'Bar<'a0> : 'a0 -> int' matches multiple overloads of the same method.\nPlease restrict it to one of the following:\r\nBar : double -> int\r\n Bar : int -> int."
110
+
FSharpErrorSeverity.Error,366,(7,15,7,24),"No implementation was given for those members: "+ System.Environment.NewLine +"\t'abstract member IOverload.Bar : double -> int'"+ System.Environment.NewLine +"\t'abstract member IOverload.Bar : int -> int'"+ System.Environment.NewLine +"Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'."
111
+
FSharpErrorSeverity.Error,3213,(8,21,8,24),"The member 'Bar<'a0> : 'a0 -> int' matches multiple overloads of the same method.\nPlease restrict it to one of the following:"+ System.Environment.NewLine +"Bar : double -> int"+ System.Environment.NewLine +" Bar : int -> int."
(FSharpErrorSeverity.Error,1,(6,19,6,25),("This expression was expected to have type\n 'A (libA, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null)' \nbut here has type\n 'A (libB, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null)' "))
66
+
(FSharpErrorSeverity.Error,1,(11,19,11,25),("This expression was expected to have type\n 'B<Microsoft.FSharp.Core.int> (libA, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null)' \nbut here has type\n 'B<Microsoft.FSharp.Core.int> (libB, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null)' "))
let doSomething (xs) = List.map (fun {field1=x} -> x) xs
18
-
19
17
doSomething {Record.field1=0; field2=0}
20
18
"""
21
19
[|
22
-
FSharpErrorSeverity.Error,1,(5,13,5,40),"This expression was expected to have type\n 'Record list' \nbut here has type\n 'Record' "
23
-
FSharpErrorSeverity.Warning,20,(5,1,5,40),"The result of this expression has type 'int list' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'."
20
+
FSharpErrorSeverity.Error,1,(4,13,4,40),"This expression was expected to have type\n 'Record list' \nbut here has type\n 'Record' "
21
+
FSharpErrorSeverity.Warning,20,(4,1,4,40),"The result of this expression has type 'int list' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'."
24
22
|]
25
23
26
-
[<Test>]
24
+
[<Fact>]
27
25
let``Comma In Rec Ctor``()=
28
26
CompilerAssert.TypeCheckWithErrors
29
27
"""
30
28
type Person = { Name : string; Age : int; City : string }
31
29
let x = { Name = "Isaac", Age = 21, City = "London" }
32
30
"""
33
31
[|
34
-
FSharpErrorSeverity.Error,1,(3,18,3,52),"This expression was expected to have type\n 'string' \nbut here has type\n ''a * 'b * 'c' \r\nA ';' is used to separate field values in records. Consider replacing ',' with ';'."
32
+
FSharpErrorSeverity.Error,1,(3,18,3,52),"This expression was expected to have type\n 'string' \nbut here has type\n ''a * 'b * 'c' "+ System.Environment.NewLine +"A ';' is used to separate field values in records. Consider replacing ',' with ';'."
35
33
FSharpErrorSeverity.Error,764,(3,9,3,54),"No assignment given for field 'Age' of type 'Test.Person'"
36
34
|]
37
35
38
-
[<Test>]
36
+
[<Fact>]
39
37
let``Missing Comma In Ctor``()=
40
38
CompilerAssert.TypeCheckWithErrors
41
39
"""
@@ -48,13 +46,13 @@ let p =
48
46
Age = 18)
49
47
"""
50
48
[|
51
-
FSharpErrorSeverity.Error,39,(7,12,7,16),"The value or constructor 'Name' is not defined. Maybe you want one of the following:\r\n nan"
49
+
FSharpErrorSeverity.Error,39,(7,12,7,16),"The value or constructor 'Name' is not defined. Maybe you want one of the following:"+ System.Environment.NewLine +" nan"
52
50
FSharpErrorSeverity.Warning,20,(7,12,7,25),"The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'."
53
51
FSharpErrorSeverity.Error,39,(8,12,8,15),"The value or constructor 'Age' is not defined."
54
52
FSharpErrorSeverity.Error,501,(7,5,8,21),"The object constructor 'Person' takes 0 argument(s) but is here given 1. The required signature is 'new : unit -> Person'. If some of the arguments are meant to assign values to properties, consider separating those arguments with a comma (',')."
55
53
|]
56
54
57
-
[<Test>]
55
+
[<Fact>]
58
56
let``Missing Ctor Value``()=
59
57
CompilerAssert.TypeCheckSingleError
60
58
"""
@@ -71,7 +69,7 @@ let p =
71
69
(7,5,8,21)
72
70
"The member or object constructor 'Person' requires 1 argument(s). The required signature is 'new : x:int -> Person'."
73
71
74
-
[<Test>]
72
+
[<Fact>]
75
73
let``Extra Argument In Ctor``()=
76
74
CompilerAssert.TypeCheckSingleError
77
75
"""
@@ -87,7 +85,7 @@ let p =
87
85
(7,5,7,14)
88
86
"The object constructor 'Person' takes 0 argument(s) but is here given 1. The required signature is 'new : unit -> Person'."
89
87
90
-
[<Test>]
88
+
[<Fact>]
91
89
let``Extra Argument In Ctor2``()=
92
90
CompilerAssert.TypeCheckSingleError
93
91
"""
@@ -105,7 +103,7 @@ let p =
105
103
(9,5,9,16)
106
104
"The object constructor 'Person' takes 0 argument(s) but is here given 1. The required signature is 'new : unit -> Person'."
0 commit comments