Skip to content

Commit

Permalink
Allow to name existentials in pattern-matching (ocaml#9584)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrigue authored and smuenzel committed Mar 30, 2021
1 parent 4cd54ea commit e0eb793
Show file tree
Hide file tree
Showing 34 changed files with 6,070 additions and 2,298 deletions.
1 change: 1 addition & 0 deletions .depend
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ typing/ctype.cmi : \
typing/type_immediacy.cmi \
typing/path.cmi \
parsing/longident.cmi \
parsing/location.cmi \
typing/ident.cmi \
typing/env.cmi \
parsing/asttypes.cmi
Expand Down
5 changes: 5 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ Working version

### Type system:

- #9584, #7074: Allow to name existentials in pattern-matching
One can now write '(Cstr (type a) (x, y : int * a))' to give a name to
existentials freshly introduced by GADT constructors.
(Jacques Garrigue, review by Leo White and Gabriel Scherer)

- #10174: Make Tsubst more robust by avoiding strange workarounds
(Takafumi Saikawa and Jacques Garrigue, review by Gabriel Scherer and
Florian Angeletti)
Expand Down
4,403 changes: 2,248 additions & 2,155 deletions boot/menhir/parser.ml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lambda/matching.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1746,12 +1746,12 @@ let divide_constant ctx m =
(* Matching against a constructor *)

let get_key_constr = function
| { pat_desc = Tpat_construct (_, cstr, _) } -> cstr
| { pat_desc = Tpat_construct (_, cstr, _, _) } -> cstr
| _ -> assert false

let get_pat_args_constr p rem =
match p with
| { pat_desc = Tpat_construct (_, _, args) } -> args @ rem
| { pat_desc = Tpat_construct (_, _, args, _) } -> args @ rem
| _ -> assert false

let get_expr_args_constr ~scopes head (arg, _mut) rem =
Expand Down

0 comments on commit e0eb793

Please sign in to comment.