While trying to figure out how the type
keyword behaves in function signatures, I ran into a syntax error that provides no error message or line number:
I'm using the latest v12 beta.
let rec patternMatching : type inputStream callback. (ev: event<'inputStream, 'callback>) => unit {
switch ev {
| Pipe => patternMatching(Data)
| Data => patternMatching(End)
| End => ()
}
}
This crashes with Fatal error: exception Syntaxerr.Error(_)
. The code is clearly not valid, but it ought to still report an error cleanly.
Interestingly if you just remove the ticks from the type parameters in event
the compiler produces an error successfully. I suspect that the syntax sugar for locally abstract types is probably to blame somehow.