Compiles:
let inline f< ^T when ^T : (static member (<<<) : ^T * int -> ^T) > (x : ^T) = x <<< 1
Does not compile:
let inline f< ^T when ^T : (static member (>>>) : ^T * int -> ^T) > (x : ^T) = x >>> 1
Errors:
Adding spaces doesn't help; this line yields the same compiler errors:
let inline f< ^T when ^T : (static member ( >>> ) : ^T * int -> ^T) > (x : ^T) = x >>> 1
I've searched both the documentation and the specification, to no avail. Is this a bug? Is there some way to include the >
characters in the member signature?
Sure looks like a bug. It's ugly, but one workaround is to use the long form of the operator name:
let inline f< ^T when ^T : (static member op_RightShift : ^T * int -> ^T)> (x : ^T) =
x >>> 1
Do you even need an explicit constraint? This works just as well:
let inline f (x: ^T) : ^T = x >>> 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With