diff options
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | parsing/parser.mly | 5 |
2 files changed, 6 insertions, 0 deletions
@@ -63,6 +63,7 @@ Features wishes: - PR#6071: Add a -noinit option to the toplevel (patch by David Sheets) - PR#6166: document -ocamldoc option of ocamlbuild - PR#6246: allow wilcard _ as for-loop index +- PR#5808: allow simple patterns, not only identifiers, in "let p : t = ..." OCaml 4.01.1: ------------- diff --git a/parsing/parser.mly b/parsing/parser.mly index 3bb662087..f08afc21d 100644 --- a/parsing/parser.mly +++ b/parsing/parser.mly @@ -1248,6 +1248,8 @@ let_binding_: (ghpat(Ppat_constraint(mkpatvar $1 1, poly)), exp) } | pattern EQUAL seq_expr { ($1, $3) } + | simple_pattern_not_ident COLON core_type EQUAL seq_expr + { (ghpat(Ppat_constraint($1, $3)), $5) } ; fun_binding: strict_binding @@ -1356,6 +1358,9 @@ pattern: simple_pattern: val_ident %prec below_EQUAL { mkpat(Ppat_var (mkrhs $1 1)) } + | simple_pattern_not_ident { $1 } +; +simple_pattern_not_ident: | UNDERSCORE { mkpat(Ppat_any) } | signed_constant |