From a07da57fe846cd6a678a7aea307b4783df2a0cef Mon Sep 17 00:00:00 2001 From: Edgar Date: Mon, 15 Aug 2022 21:53:49 +0100 Subject: [PATCH] AutoOpen Obsolete Attribute --- .../ObsoleteAttributeCheckingTests.fs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs index 17d6f02625..c2fa57509f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs @@ -609,6 +609,43 @@ let value2 = class1.A <- 12 (Error 101, Line 8, Col 14, Line 8, Col 22, "This construct is deprecated. member A is deprecated") (Error 101, Line 9, Col 14, Line 9, Col 22, "This construct is deprecated. member A is deprecated") ] + + [] + let ``Obsolete attribute warning is taken into account when a module is is marked as [] but not when calling a function`` () = + Fsx """ +[] +[] +module MyModule = + let testFun () = printfn "test" + +open MyModule + +testFun () + """ + |> compile + |> shouldFail + |> withDiagnostics [ + (Warning 44, Line 7, Col 6, Line 7, Col 14, "This construct is deprecated. This is obsolete") + ] + + [] + let ``Obsolete attribute error is taken into account when a module is is marked as [] but not when calling a function`` () = + Fsx """ +[] +[] +module MyModule = + let testFun () = printfn "test" + +open MyModule + +testFun () + """ + |> ignoreWarnings + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 101, Line 7, Col 6, Line 7, Col 14, "This construct is deprecated. This is obsolete") + ] [] let ``Obsolete attribute warning is taken into account when used on an C# struct`` () =