Consider this code:
type A =
| A of int
static member M(A x) : int = x
static member M(A x) : string = x.ToString()
This leads to the following compilation error:
Duplicate method. The method 'M' has the same name and signature as another method in type 'A'.

I assume "signature" refers to the parameters and ignores the return type. However, using the name op_Implicit works fine:
type A =
| A of int
static member op_Implicit(A x) : int = x
static member op_Implicit(A x) : string = x.ToString()
Why should it depend on the name? Is this a bug?
My use-case is that I am using some SRTP helpers to convert between compatible types, but I'd like to move away from relying on op_Implicit for these helpers in order to force myself to use these helpers. With op_Implicit, I get automatic conversion at method call sites (but I don't want to enable the warning/error for this, since I want that implicit conversion for some built-in .NET APIs/types).
Related information
- Windows 11
- Rider 2022.2.3