Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,34 @@ while x < 3 do
|> withSingleDiagnostic (Warning 20, Line 6, Col 5, Line 6, Col 6,
"The result of this expression has type 'int' 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'.")

[<Fact>]
let ``Warn On Last Expression Inside async Computation Expression - highlights only offending expression``() =
FSharp """
let _ =
async {
for _ in [1] do
let x = 1
x
}
"""
|> typecheck
|> shouldFail
|> withSingleDiagnostic (Warning 20, Line 6, Col 13, Line 6, Col 14,
"The result of this expression has type 'int' 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'.")

[<Fact>]
let ``No Warning 20 For Trailing Non-unit Expression In seq Computation Expression (implicit yield)``() =
FSharp """
let _ =
seq {
for _ in [1] do
let x = 1
x
}
"""
|> typecheck
|> shouldSucceed

[<Fact>]
let ``Warn If Possible Property Setter``() =
FSharp """
Expand Down
Loading