Skip to content

Undocumented syntax error when using type in function signature #7850

@Josef-Thorne-A

Description

@Josef-Thorne-A

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions