Cannot implement a generic interface with static abstract members with different generic arguments
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 144
Description
I'm experimenting with the new `System.Numerics` namespace and came across an issue with generic interfaces with static abstract members. I cannot implement a generic interface with static abstract members with different generic arguments. In this example, I want to implement `IMultiplyOperators` and `IMultiplyOperators`.
```fsharp
open System.Numerics
type Vector = Vector of x: double * y: double * z: double with
//factor
static member (*) (Vector (x, y, z), f) =
Vector (x * f, y * f, z * f)
//cross product
static member (*) (Vector (x1, y1, z1), Vector (x2, y2, z2)) =
Vector (y1 * z2 - z1 * y2, z1 * x2 - x1 * z2, x1 * y2 - y1 * x2)
interface IMultiplyOperators with
static member (*) (a, f) = a * f
interface IMultiplyOperators with
static member (*) (a, b) = a * b
```
I'm getting the following compiler errors:
```
Program.fs(13,15): error FS0001: This expression was expected to have type 'decimal' but here has type 'Vector'
Program.fs(13,15): error FS0001: This expression was expected to have type 'decimal' but here has type 'Vector'
Program.fs(13,15): error FS0909: All implemented interfaces should be declared on the initial declaration of the type
```
* net7.0
* FSharp.Core 7.0.300
* Visual Studio 17.6.5
* MSBuild version 17.6.8+c70978d4d for .NET
[VectorTry.zip](https://github.com/dotnet/fsharp/files/12214080/VectorTry.zip)
Contributor guide
Assessment
This issue has not been assessed yet.