From 4907bcf8037fc0b629d96331c0b1a210c1db58a4 Mon Sep 17 00:00:00 2001 From: Gabriel Scherer Date: Mon, 12 May 2014 15:38:07 +0000 Subject: [PATCH] typecore.ml: fix format's expected-type mistake git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14826 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- typing/typecore.ml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/typing/typecore.ml b/typing/typecore.ml index 6e5e4c36f..b6cb5e412 100644 --- a/typing/typecore.ml +++ b/typing/typecore.ml @@ -1792,7 +1792,8 @@ and type_expect_ ?in_function env sexp ty_expected = | _ -> false in if is_format then - type_format loc str env sexp.pexp_attributes + let format_parsetree = { sexp with pexp_desc = type_format loc str env } in + type_expect ?in_function env format_parsetree ty_expected else rue { exp_desc = Texp_constant cst; @@ -2743,7 +2744,7 @@ and get_camlinternalFormat_path env tyname = Some (Path.Pdot (cfb_path, tyname, 0)) with Not_found -> None -and type_format loc str env attr = +and type_format loc str env = try CamlinternalFormatBasics.(CamlinternalFormat.( let mk_exp_loc pexp_desc = { @@ -2987,12 +2988,7 @@ and type_format loc str env attr = | 0 -> [] | _ -> mk_typ_loc Ptyp_any :: gen_params (n - 1) in mk_typ_loc (Ptyp_constr (mk_lid_loc lid, gen_params 6)) in - let constrained_exp = { - pexp_desc = Pexp_constraint (exp, pervasives_format6_ty); - pexp_loc = loc; - pexp_attributes = attr; - } in - type_exp env constrained_exp + Pexp_constraint (exp, pervasives_format6_ty) )) with Failure msg -> raise (Error (loc, env, Invalid_format msg))