The following code gives an compilation error about being "not sufficiently generic". What is wrong?
type SameLenVectors<'T when 'T: (static member ( ): 'T * 'T -> 'T) and 'T: (static member (*): 'T * 'T -> 'T)> =
private SameLenVectors of 'T list list
member this.Item = 1
CodePudding user response:
'T is a statically resolved type parameter (SRTP), so it must be inlined at the call site:
member inline this.Item = 1
It's a bit confusing, since you've declared the type parameter as 'T rather than ^T, but it's an SRTP nonetheless (as evidenced by the compiler error).
