Description
This is fine:
let inline IsEqual< ^t when ^t: equality> (x: ^t) =
x = x
But this is not:
let inline (|IsEqual|IsNonEqual|)< ^t when ^t : equality> (x: ^t) =
if x = x then -> IsEqual
else IsNonEqual
Note: the code above does not require an explicit SRTP, but I just wanted to keep it simple. The actual example came from my comment here: fsharp/fslang-suggestions#661 (comment)
It can be seen with any SRTP type constraint, the full warning being:
warning FS1189: Remove spaces between the type name and type parameter, e.g. "type C<'T>", not type "C <'T>". Type parameters must be placed directly adjacent to the type name.
Known workarounds
Ignore the warning (but that will ignore it for the whole file).
Other info
It has been reported before, but writing <^t
instead of < ^t
will yield a syntax error. Though I doubt that is the space the compiler complains about.
Also: the actual warning doesn't seem tailored for SRTP, it shows examples for normal type constraints, which can be confusing.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status