Skip to content

Commit

Permalink
Allow 'as' variables to bind labels in pattens. For example
Browse files Browse the repository at this point in the history
   fun { { x ; y } as p; q } -> e

is equivalent to

   fun { p = { x ; y } as p; q } -> e
  • Loading branch information
yallop committed Jun 17, 2016
1 parent 266c147 commit 42f6bc0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions parsing/parser.mly
Expand Up @@ -1887,6 +1887,10 @@ lbl_pattern:
{ (mkrhs $1 1, mkpat_opt_constraint $4 $2) }
| label_longident opt_pattern_type_constraint
{ (mkrhs $1 1, mkpat_opt_constraint (pat_of_label $1 1) $2) }
| pattern AS label_longident opt_pattern_type_constraint
{ (mkrhs $3 3,
mkpat_opt_constraint
(mkpat (Ppat_alias($1, mkrhs (Longident.last $3) 3))) $4) }
;
opt_pattern_type_constraint:
COLON core_type { Some $2 }
Expand Down

0 comments on commit 42f6bc0

Please sign in to comment.