Hi,
I have a class called Vector which implements a number of operators such as + and properties such as Count. Vector is also subtyped by classes such as DenseVector, SparseVector which inherit from Vector. Now in F# when I write the following
let foo (v : #Vector) (w : #Vector) = v + w
let bar (v : #Vector) (w : #Vector) = v.Count + w.Count
For "foo" I get the warning: "This construct causes code to be less generic than indicated by its type annotations. The type variable implied by the use of a '#', '_' or other type annotation at or near ... has been constrained to be type 'Vector'." while "bar" works just fine.
I don't understand why the flexible type constraint works fine for properties but for operator resolution it's having trouble. Any explanations/ideas/workarounds ?
EDIT My Vector class is abstract and has an operator with the following signature:
public static Vector operator +(Vector leftSide, Vector rightSide)