From 5847249fe6effa6c5fc027194bbd43dd1ead47cf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 13:29:23 +0000 Subject: [PATCH] Add regression test: #7177, never-matched warning with active patterns Fixes https://github.com/dotnet/fsharp/issues/7177 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../ErrorMessages/DiagnosticRegressionTests.fs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/DiagnosticRegressionTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/DiagnosticRegressionTests.fs index 99d39b28fcd..36e258e4dd1 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/DiagnosticRegressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/DiagnosticRegressionTests.fs @@ -51,6 +51,23 @@ type Vehicle() = class end (Error 267, Line 3, Col 7, Line 3, Col 29, "This is not a valid constant expression or custom attribute value") ] +// https://github.com/dotnet/fsharp/issues/7177 +[] +let ``Issue 7177 - never matched warning FS0026 is emitted when active pattern precedes wildcard rules`` () = + FSharp """ +let (|AP|_|) (x: obj) = Some() + +let _ = + match obj() with + | AP _ -> () + | _ -> () + | _ -> () + """ + |> asLibrary + |> typecheck + |> shouldFail + |> withWarningCode 26 + // https://github.com/dotnet/fsharp/issues/16410 [] let ``Issue 16410 - no spurious FS3570 warning with KeyValue active pattern`` () =