Recursive type with a legal Zero value fails to compile
Open
Area-Compiler-Checking
Area-Compiler-SRTP
Bug
Impact-Low
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
Consider the following code:
```fsharp
type Foo<'t when 't : (static member Zero : 't)> =
| MkFoo of 't
type Bar =
| Nil
| MkBar of Foo // Error: The type 'Bar' does not support the operator 'get_Zero'
static member Zero
with get () = Nil
let zeroBar = LanguagePrimitives.GenericZero // this compiles fine, so Bar definitely has a legal Zero value
```
**Expected behavior**
Should compile with no problems.
**Actual behavior**
Compiler error: `The type 'Bar' does not support the operator 'get_Zero'`
**Known workarounds**
None
Contributor guide
Assessment
This issue has not been assessed yet.