diff options
author | Jacques Le Normand <rathereasy@gmail.com> | 2010-12-03 01:49:08 +0000 |
---|---|---|
committer | Jacques Le Normand <rathereasy@gmail.com> | 2010-12-03 01:49:08 +0000 |
commit | eddcc06798585614491232a07d5401343c8dd134 (patch) | |
tree | 4b43c944e1a6017e14b2a437b351fe121f21fd0a | |
parent | d77b95fc564c2a1f2f2d6ef03eff39703f8673da (diff) | |
download | ocaml-eddcc06798585614491232a07d5401343c8dd134.tar.gz |
fixed bug in syntactic sugar translation
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gadts@10879 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | parsing/parser.mly | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/parsing/parser.mly b/parsing/parser.mly index b5a4e2bf05..5fed640b37 100644 --- a/parsing/parser.mly +++ b/parsing/parser.mly @@ -248,12 +248,15 @@ let variables_of_type = let varify_constructors var_names t = let counter = ref 0 in let offlimits = variables_of_type t in + let freshly_created = ref [] in let rec fresh () = let ret = "x" ^ (string_of_int !counter) in counter := !counter + 1; if List.mem ret offlimits then fresh () else - ret + begin + freshly_created := ret :: !freshly_created; + ret end in let sofar : (string,string) Hashtbl.t = Hashtbl.create 0 in let rec loop t = @@ -304,7 +307,7 @@ let varify_constructors var_names t = | Rinherit t -> Rinherit (loop t) in - loop t + (!freshly_created,loop t) %} @@ -1197,10 +1200,10 @@ let_binding: | [] -> assert false in let exp = mk_newtypes newtypes in - let core_type = varify_constructors newtypes core_type in + let polyvars, core_type = varify_constructors newtypes core_type in (ghpat(Ppat_constraint({ppat_desc = Ppat_var $1; ppat_loc = rhs_loc 1}, - ghtyp(Ptyp_poly(List.map (fun s -> "&" ^ s) newtypes,core_type)))), + ghtyp(Ptyp_poly(polyvars,core_type)))), exp) } | pattern EQUAL seq_expr |