bogus "Incomplete pattern matches on this expression" warning on total active pattern.
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
This code generates a bogus warning on the line marked `// here`
```fsharp
type FreeNode<'f,'t> = Pure of 't | Roll of obj
let inline unroll (f: FreeNode<'a,'T>) : 'b when (^a or ^b) : (static member Something : unit -> unit) =
match f with
| Pure _ -> failwith "a"
| Roll x -> unbox x
let inline (|Pure|Roll|) (f: FreeNode<'a,'c>) : Choice<'c,'b> when (^b) : (static member Something : unit -> unit) =
match f with
| FreeNode.Pure x -> Pure x
| FreeNode.Roll _ -> let x = unroll f in Roll x
let inline fold (f: 'f -> 'm) (x) : 'm =
let rec loop _ =
function // here
| Pure _ -> failwith "b"
| Roll _ -> failwith "c"
loop f x
```
The code is simplified from original in FSharpPlus library where the same warning appears in the implementation but will also impact consumers of the library as the active pattern is expected to be used.
**Actual behavior**
> warning FS0025: Incomplete pattern matches on this expression.
**Expected behavior**
The warning shouldn't happen.
**Known workarounds**
TBD
**Related information**
Issue initially noticed in https://github.com/fsprojects/FSharpPlus/blob/c17698e3d75bf852ee791b65515be4b05a6808cb/src/FSharpPlus/Free.fs#L107
> Microsoft (R) F# Interactive version 10.7.0.0 for F# 4.7
Contributor guide
Assessment
This issue has not been assessed yet.