Skip to content

Commit

Permalink
Allow single arg function type specs w/o parens
Browse files Browse the repository at this point in the history
  • Loading branch information
tjammer committed Feb 11, 2024
1 parent 849c3ab commit a213fab
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4,518 deletions.
7 changes: 6 additions & 1 deletion lib/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -474,16 +474,21 @@ type_path_cont:
let parens(x) :=
| Lpar; items = separated_list(Comma, x); Rpar; { items }

type_spec:
single_type_spec:
| id = Ident { Ty_id id }
| id = poly_id { Ty_var id }
| id = Sized_ident { Ty_id id }
| id = Unknown_sized_ident { Ty_id id }
| path = type_path { Ty_use_id ($loc, path) }

type_spec:
| spec = single_type_spec { spec }
| head = type_spec; Lpar; tail = separated_nonempty_list(Comma, type_spec); Rpar
{ Ty_applied (head :: tail) }
| Lpar; Rpar; Right_arrow; ret = type_spec; %prec Type_application
{ Ty_func ([Ty_id "unit", Dnorm; ret, Dnorm]) }
| spec = single_type_spec; Right_arrow; ret = type_spec
{ Ty_func ([spec, Dnorm; ret, Dnorm]) }
| Lpar; spec = tup_or_fun { spec }

tup_or_fun:
Expand Down
Loading

0 comments on commit a213fab

Please sign in to comment.