fsharp / fsharp/fslang-suggestions

Tracking suggestion: Active patterns disables the detection of simple duplicates cases.

Open
#586 0 comments 7 reactions 0 assignees View on GitHub
approved-in-principle area: tooling
Dominant language
No language data
Stars
373
Forks
21
PR merge metrics
No merged PRs in 30d

Description

Tracking this suggestion: https://github.com/Microsoft/visualfsharp/issues/2754

Presence of active patterns disables the detection of simple duplicates cases.
```fsharp
type Foo = A | B | C

let good = function
| A -> ()
| B -> ()
| B -> () // Squiggly with warning "This rule will never be matched"
| _ -> ()
| _ -> () // Squiggly with warning "This rule will never be matched"

let (|IsA|_|) x = if x = A then Some () else None

let bad = function
| IsA -> ()
| B -> ()
| B -> () // no warning
| _ -> ()
| _ -> () // no warning
```
When active patterns are present checking whether a match is exhaustive clearly becomes difficult/impossible but duplicate cases can still be detected.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.