summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémie Dimino <jeremie@dimino.org>2011-12-16 20:33:18 +0000
committerJérémie Dimino <jeremie@dimino.org>2011-12-16 20:33:18 +0000
commitac3d343a257ab6a85375ebe45bbd9e8351f76ae6 (patch)
tree0397069ba2f726a7875d0800cf0214aeeb4835c7
parentb50f1df8ff4b56b679f3719d42a1d41266da54af (diff)
Fix printing of GADTs by Camlp4 with original syntax
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11321 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--camlp4/Camlp4/Printers/OCaml.ml7
1 files changed, 6 insertions, 1 deletions
diff --git a/camlp4/Camlp4/Printers/OCaml.ml b/camlp4/Camlp4/Printers/OCaml.ml
index 972032553..24c4bac1a 100644
--- a/camlp4/Camlp4/Printers/OCaml.ml
+++ b/camlp4/Camlp4/Printers/OCaml.ml
@@ -371,7 +371,12 @@ module Make (Syntax : Sig.Camlp4Syntax) = struct
match Ast.list_of_ctyp t [] with
[ [] -> ()
| ts ->
- pp f "@[<hv0>| %a@]" (list o#ctyp "@ | ") ts ];
+ pp f "@[<hv0>| %a@]" (list o#constructor_declaration "@ | ") ts ];
+
+ method private constructor_declaration f t =
+ match t with
+ [ <:ctyp< $t1$ : $t2$ -> $t3$ >> -> pp f "@[<2>%a :@ @[<2>%a@ ->@ %a@]@]" o#ctyp t1 o#constructor_type t2 o#ctyp t3
+ | t -> o#ctyp f t ];
method string f = pp f "%s";
method quoted_string f = pp f "%S";