Open static named literals can't be used in pattern matching
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
Named literals brought into scope by `open`ing a static class can't be used for pattern matching.
**Repro steps**
1. Open a static class that contains named literals as members. (F# can't currently define named literals as public class members, but `System.Math` will do for the repro.)
2. Try to use a named literal from that class in a match expression.
Repro code:
```F#
open type System.Math
let isPi x = match x with PI -> true | _ -> false
```
**Expected behavior**
The named literal is actually matched as a literal expression.
**Actual behavior**
The name of the literal introduces a new variable binding.
**Known workarounds**
Either qualify the named literal (`System.Math.PI`) or redefine the literal in the current module (`let [] PI = PI`).
**Related information**
* .NET Core SDK 3.1.100 (also in 3.0.100)
* `preview` of course.
Contributor guide
Assessment
This issue has not been assessed yet.