Optionally relax signatures of X, sin X, cos X to allow use w.r.t. subtyping
See https://github.com/Microsoft/visualfsharp/issues/799
type Base(x : int) =
member self.X = x
static member (~) (a : Base) = Base(a.X)
static member (+) (a : Base, b : Base) = Base(a.X + b.X)
static member Cos(a : Base) = Base(2*a.X)
type Derived(x : int) =
inherit Base(x)
let a = Base(1)
let minusa = a // OK
let cosa = cos a // OK
let twoa = a + a // OK
let b = Derived(1)
let minusb = b // Compile error
let cosb = cos b // Compile error
let twob = b + b // OK
Marking as approvedinprinciple per my comment below
We will post an RFC for it in due course.
Don Syme, F# Language and Core Library Evolution
1 comment

Don Syme commented
This is a reasonable request and we should accommodate this somehow. Unfortunately we will likely only be able to do it by having the user open a new module.