Skip to content

Commit 9b016f5

Browse files
Add regression test: #7177, never-matched warning with active patterns (#19528)
Fixes #7177 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 02b1081 commit 9b016f5

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tests/FSharp.Compiler.ComponentTests/ErrorMessages/DiagnosticRegressionTests.fs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,23 @@ type Vehicle() = class end
5151
(Error 267, Line 3, Col 7, Line 3, Col 29, "This is not a valid constant expression or custom attribute value") ]
5252

5353

54+
// https://github.com/dotnet/fsharp/issues/7177
55+
[<Fact>]
56+
let ``Issue 7177 - never matched warning FS0026 is emitted when active pattern precedes wildcard rules`` () =
57+
FSharp """
58+
let (|AP|_|) (x: obj) = Some()
59+
60+
let _ =
61+
match obj() with
62+
| AP _ -> ()
63+
| _ -> ()
64+
| _ -> ()
65+
"""
66+
|> asLibrary
67+
|> typecheck
68+
|> shouldFail
69+
|> withWarningCode 26
70+
5471
// https://github.com/dotnet/fsharp/issues/16410
5572
[<Fact>]
5673
let ``Issue 16410 - no spurious FS3570 warning with KeyValue active pattern`` () =

0 commit comments

Comments
 (0)