dotnet / dotnet/fsharp

Incomplete compiler warning on pattern matches with guards

Open
#11,673 2 comments 0 reactions 0 assignees View on GitHub
Area-Compiler-PatternMatching Feature Request
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

The compiler is truncating the warning on a pattern match with guards that is not covering all possibilities

**Repro steps**
```fsharp
type Sample = Sample of bool
let example a =
match a with
| Sample t when t -> 1
| Sample t when t -> 2
```

OR

```fsharp
type Sample = Sample of bool
let example = function
| Sample t when t -> 1
| Sample t when t -> 2
```

**Expected behavior**

The warning along the lines:
` warning FS0025: Incomplete pattern matches on this expression. For example, the value '(Sample false)' may indicate a case not covered by the pattern(s).`

**Actual behavior**
The incomplete warning message:
`warning FS0025: Incomplete pattern matches on this expression.`

**Related information**

* Operating system Windows 10 Pro 64
* .NET Runtime kind .NET Core 5.0
* Editing Tools Visual Studio 2019, Visual Studio Code

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.