未验证 提交 38271400 编写于 作者: E Edgar Gonzalez 提交者: GitHub

More DU obsolete attribute tests (#13996)

上级 30b3a8fa
...@@ -205,7 +205,77 @@ C.Update() ...@@ -205,7 +205,77 @@ C.Update()
|> shouldFail |> shouldFail
|> withDiagnostics [ |> withDiagnostics [
(Error 101, Line 9, Col 1, Line 9, Col 9, "This construct is deprecated. Use B instead") (Error 101, Line 9, Col 1, Line 9, Col 9, "This construct is deprecated. Use B instead")
] ]
[<Fact>]
let ``Obsolete attribute error is taken into account when used on a struct du and invocation`` () =
Fsx """
open System
[<Struct>]
[<Obsolete("Use B instead", true)>]
type Color =
| Red
| Green
let c = Color.Red
"""
|> ignoreWarnings
|> compile
|> shouldFail
|> withDiagnostics [
(Error 101, Line 9, Col 9, Line 9, Col 14, "This construct is deprecated. Use B instead")
]
[<Fact>]
let ``Obsolete attribute error is taken into account when used on a du and invocation`` () =
Fsx """
open System
[<Obsolete("Use B instead", true)>]
type Color =
| Red
| Green
let c = Color.Red
"""
|> ignoreWarnings
|> compile
|> shouldFail
|> withDiagnostics [
(Error 101, Line 8, Col 9, Line 8, Col 14, "This construct is deprecated. Use B instead")
]
[<Fact>]
let ``Obsolete attribute error is taken into account when used on a du field and invocation`` () =
Fsx """
open System
type Color =
| [<Obsolete("Use B instead", true)>] Red
| Green
let c = Color.Red
"""
|> ignoreWarnings
|> compile
|> shouldFail
|> withDiagnostics [
(Error 101, Line 7, Col 9, Line 7, Col 18, "This construct is deprecated. Use B instead")
]
[<Fact>]
let ``Obsolete attribute warning is taken into account when used on a du field and invocation`` () =
Fsx """
open System
type Color =
| [<Obsolete("Use B instead")>] Red
| Green
let c = Color.Red
"""
|> compile
|> shouldFail
|> withDiagnostics [
(Warning 44, Line 7, Col 9, Line 7, Col 18, "This construct is deprecated. Use B instead")
]
[<Fact>] [<Fact>]
let ``Obsolete attribute error is taken into account when used on an enum and invocation`` () = let ``Obsolete attribute error is taken into account when used on an enum and invocation`` () =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册