Wrong confusing warning FS1189 when using SRTP with active patterns
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
This is fine:
```f#
let inline IsEqual< ^t when ^t: equality> (x: ^t) =
x = x
```
But this is not:
```f#
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: https://github.com/fsharp/fslang-suggestions/issues/661#issuecomment-548542518
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.
Contributor guide
Assessment
This issue has not been assessed yet.