Commit 07948b5b authored by POTTIER Francois's avatar POTTIER Francois

Compatibility with OCaml 4.05.0.

parent c8f02bab
......@@ -387,7 +387,7 @@ let ty_env =
let tyvar_visitor_method_type =
if X.poly "env" then
Typ.poly ["env"] (ty_arrow ty_env ty_any)
typ_poly ["env"] (ty_arrow ty_env ty_any)
else
ty_any
......@@ -538,7 +538,7 @@ let quantify (alphas : tyvars) (ty : core_type) : core_type =
alphas
in
(* Done. *)
Typ.poly alphas ty
typ_poly alphas ty
(* -------------------------------------------------------------------------- *)
......
let mknoloc = Location.mknoloc
open Asttypes
open Parsetree
open Ast_helper
......@@ -68,3 +69,21 @@ let data_constructor_variety (cd : constructor_declaration) =
| Pcstr_record lds ->
DataInlineRecord (ld_labels lds, ld_tys lds)
#endif
(* Between OCaml 4.04 and OCaml 4.05, the types of several functions in [Ast_helper]
have changed. They used to take arguments of type [string], and now take arguments
of type [str], thus requiring a conversion. These functions include [Typ.object_],
[Typ.poly], [Exp.send], [Exp.newtype], [Ctf.val_], [Ctf.method_], [Cf.inherit_]. *)
let string2str (s : string) =
#if OCAML_VERSION < (4, 05, 0)
s
#else
mknoloc s
#endif
let typ_poly (tyvars : string list) (cty : core_type) : core_type =
Typ.poly (List.map string2str tyvars) cty
let exp_send (e : expression) (m : string) : expression =
Exp.send e (string2str m)
......@@ -467,7 +467,7 @@ let is_virtual (Meth (_, _, oe, _)) : bool =
(* [send o m es] produces a call to the method [o#m] with arguments [es]. *)
let send (o : variable) (m : methode) (es : expressions) : expression =
app (Exp.send (evar o) m) es
app (exp_send (evar o) m) es
(* -------------------------------------------------------------------------- *)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment