Static abstracts implemented/inherited in another interface don't work
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 144
Description
Static abstract implemented/inherited in another interface doesn't work
**Repro steps**
```
open System
open System.Collections.Generic
type ISemigroup<'T> = static abstract op_AdditionAddition : 'T * 'T -> 'T
[]
type NonEmptySeq<'t> =
inherit IEnumerable<'t>
abstract member First: 't
interface ISemigroup> with
static member op_AdditionAddition (x: 't NonEmptySeq, y) =
let unsafeOfSeq (seq: _ seq) =
{ new NonEmptySeq<_> with
member _.First = Seq.head seq
member _.GetEnumerator() = seq.GetEnumerator()
member _.GetEnumerator() = seq.GetEnumerator() :> Collections.IEnumerator }
let append (source1: 'a NonEmptySeq) (source2: 'a NonEmptySeq) = Seq.append source1 source2 |> unsafeOfSeq
append x y
```
**Expected behavior**
Compile
**Actual behavior**
```
..fsx(12,15): error FS1207: Interfaces inherited by other interfaces should be declared using 'inherit ...' instead of 'interface ...'
```
Then I try what the error message suggests:
```
open System
open System.Collections.Generic
type ISemigroup<'T> = static abstract op_AdditionAddition : 'T * 'T -> 'T
[]
type NonEmptySeq<'t> =
inherit IEnumerable<'t>
abstract member First: 't
static member op_AdditionAddition (x: 't NonEmptySeq, y) =
let unsafeOfSeq (seq: _ seq) =
{ new NonEmptySeq<_> with
member _.First = Seq.head seq
member _.GetEnumerator() = seq.GetEnumerator()
member _.GetEnumerator() = seq.GetEnumerator() :> Collections.IEnumerator }
let append (source1: 'a NonEmptySeq) (source2: 'a NonEmptySeq) = Seq.append source1 source2 |> unsafeOfSeq
append x y
inherit ISemigroup>
```
**Expected behavior**
Compile
**Actual behavior**
```
..fsx(14,13): error FS0366: No implementation was given for 'static abstract ISemigroup.op_AdditionAddition: 'T * 'T -> 'T'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.
```
**Known workarounds**
Use C#
**Related information**
`Microsoft (R) F# Interactive version 12.8.0.0 for F# 8.0`
Contributor guide
Assessment
This issue has not been assessed yet.