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
Copy file name to clipboardExpand all lines: tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs
+27-18Lines changed: 27 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -105,9 +105,10 @@ let changeX() =
105
105
(6,5,6,15)
106
106
"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'."
107
107
108
-
[<Test>]
108
+
// [<Test>] // Disable this test until we refactor tcImports and tcGlobals
109
109
let``Warn If Discarded In List``()=
110
-
CompilerAssert.TypeCheckSingleError
110
+
CompilerAssert.TypeCheckWithErrorsAndOptions
111
+
[|"--langversion:4.6"|]
111
112
"""
112
113
let div _ _ = 1
113
114
let subView _ _ = [1; 2]
@@ -119,14 +120,17 @@ let view model dispatch =
119
120
div [] []
120
121
]
121
122
"""
122
-
FSharpErrorSeverity.Warning
123
-
3221
124
-
(9,8,9,17)
125
-
"This expression returns a value of type 'int' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield'."
123
+
[|
124
+
FSharpErrorSeverity.Warning,
125
+
3221,
126
+
(9,8,9,17),
127
+
"This expression returns a value of type 'int' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield'."
128
+
|]
126
129
127
-
[<Test>]
130
+
// [<Test>] // Disable this test until we refactor tcImports and tcGlobals
128
131
let``Warn If Discarded In List 2``()=
129
-
CompilerAssert.TypeCheckSingleError
132
+
CompilerAssert.TypeCheckWithErrorsAndOptions
133
+
[|"--langversion:4.6"|]
130
134
"""
131
135
// stupid things to make the sample compile
132
136
let div _ _ = 1
@@ -143,14 +147,17 @@ let view model dispatch =
143
147
]
144
148
]
145
149
"""
146
-
FSharpErrorSeverity.Warning
147
-
3222
148
-
(13,19,13,41)
149
-
"This expression returns a value of type 'int list' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield!'."
150
+
[|
151
+
FSharpErrorSeverity.Warning,
152
+
3222,
153
+
(13,19,13,41),
154
+
"This expression returns a value of type 'int list' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield!'."
155
+
|]
150
156
151
-
[<Test>]
157
+
// [<Test>] // Disable this test until we refactor tcImports and tcGlobals
152
158
let``Warn If Discarded In List 3``()=
153
-
CompilerAssert.TypeCheckSingleError
159
+
CompilerAssert.TypeCheckWithErrorsAndOptions
160
+
[|"--langversion:4.6"|]
154
161
"""
155
162
// stupid things to make the sample compile
156
163
let div _ _ = 1
@@ -167,10 +174,12 @@ let view model dispatch =
167
174
]
168
175
]
169
176
"""
170
-
FSharpErrorSeverity.Warning
171
-
20
172
-
(13,19,13,41)
173
-
"The result of this expression has type 'bool' 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'."
177
+
[|
178
+
FSharpErrorSeverity.Warning,
179
+
20,
180
+
(13,19,13,41),
181
+
"The result of this expression has type 'bool' 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'."
0 commit comments