You need to mark the inline element (and add type annotations if you want the arguments to be of type ^T ):
type MyType<'T when ^T: (static member ( + ) : ^T * ^T -> ^T)>() = member inline this.F (a:^T) (b:^T) = a + b
I also added a constructor so you can actually call the method:
MyType().F 1 2
As others have noted, it is rarely necessary to write explicit restrictions for members manually, as they are usually inferred. In addition, in this case there is no reason to place a constraint on the type, not the method, and the type parameterized by the statically allowed type variable is not idiomatic.
kvb May 6 '11 at 1:00 a.m. 2011-05-06 01:00
source share