From 90ffbe737a7bfbfc6ad76827a2972bf5acf1e195 Mon Sep 17 00:00:00 2001 From: Jeremie Dimino Date: Wed, 18 Mar 2015 16:47:29 +0000 Subject: [PATCH] build with trunk --- _tags | 2 ++ src/lib/uTop.cppo.ml | 8 +++++++- src/lib/uTop_complete.cppo.ml | 10 ++++++++++ src/lib/uTop_main.cppo.ml | 16 ++++++++++++++-- 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/_tags b/_tags index 0f6d93a..f9c97b0 100644 --- a/_tags +++ b/_tags @@ -3,5 +3,7 @@ : cppo_V_OCAML, package(compiler-libs) : use_camlp5 +<**/*.ml>: warn(-3-40) + # OASIS_START # OASIS_STOP diff --git a/src/lib/uTop.cppo.ml b/src/lib/uTop.cppo.ml index aafa0ab..7499481 100644 --- a/src/lib/uTop.cppo.ml +++ b/src/lib/uTop.cppo.ml @@ -288,6 +288,12 @@ let with_loc loc str = { Location.loc = loc; } +#if OCAML_VERSION >= (4, 03, 0) +let nolabel = Asttypes.Nolabel +#else +let nolabel = "" +#endif + (* Check that the given phrase can be evaluated without typing/compile errors. *) let check_phrase phrase = @@ -342,7 +348,7 @@ let check_phrase phrase = with_default_loc loc (fun () -> Str.eval - (Exp.fun_ "" None (Pat.construct unit None) + (Exp.fun_ nolabel None (Pat.construct unit None) (Exp.letmodule (with_loc loc "_") (Mod.structure (item :: items)) (Exp.construct unit None)))) diff --git a/src/lib/uTop_complete.cppo.ml b/src/lib/uTop_complete.cppo.ml index 4618a9f..6c13d8a 100644 --- a/src/lib/uTop_complete.cppo.ml +++ b/src/lib/uTop_complete.cppo.ml @@ -737,12 +737,22 @@ let rec labels_of_type acc type_expr = | Tpoly (te, _) -> labels_of_type acc te | Tarrow(label, _, te, _) -> +#if OCAML_VERSION < (4, 03, 0) if label = "" then labels_of_type acc te else if label.[0] = '?' then labels_of_type (String_map.add (String.sub label 1 (String.length label - 1)) Optional acc) te else labels_of_type (String_map.add label Required acc) te +#else + (match label with + | Nolabel -> + labels_of_type acc te + | Optional label -> + labels_of_type (String_map.add label Optional acc) te + | Labelled label -> + labels_of_type (String_map.add label Required acc) te) +#endif | Tconstr(path, _, _) -> begin match lookup_env Env.find_type path !Toploop.toplevel_env with | None diff --git a/src/lib/uTop_main.cppo.ml b/src/lib/uTop_main.cppo.ml index 97bf32e..ffcede5 100644 --- a/src/lib/uTop_main.cppo.ml +++ b/src/lib/uTop_main.cppo.ml @@ -283,6 +283,9 @@ let rec map_items unwrap wrap items = | Outcometree.Osig_modtype (name, _) | Outcometree.Osig_value (name, _, _) -> (name, Outcometree.Orec_not) +#if OCAML_VERSION >= (4, 03, 0) + | Outcometree.Osig_ellipsis -> ("", Outcometree.Orec_not) +#endif in let keep = name = "" || name.[0] <> '_' in if keep then @@ -320,6 +323,9 @@ let rec map_items unwrap wrap items = | Outcometree.Osig_typext _ #else | Outcometree.Osig_exception _ +#endif +#if OCAML_VERSION >= (4, 03, 0) + | Outcometree.Osig_ellipsis #endif | Outcometree.Osig_modtype _ | Outcometree.Osig_value _ -> @@ -393,6 +399,12 @@ let wrap_unit loc e = } #endif +#if OCAML_VERSION >= (4, 03, 0) +let nolabel = Asttypes.Nolabel +#else +let nolabel = "" +#endif + let () = (* Rewrite Lwt.t expressions to Lwt_main.run *) Hashtbl.add rewrite_rules (Longident.Ldot (Longident.Lident "Lwt", "t")) { @@ -408,7 +420,7 @@ let () = #else let open Ast_helper in with_default_loc loc (fun () -> - Exp.apply (Exp.ident (with_loc loc longident_lwt_main_run)) [("", e)] + Exp.apply (Exp.ident (with_loc loc longident_lwt_main_run)) [(nolabel, e)] ) #endif ); @@ -434,7 +446,7 @@ let () = with_default_loc loc (fun () -> Exp.apply (Exp.ident (with_loc loc longident_async_thread_safe_block_on_async_exn)) - [("", Exp.fun_ "" None punit e)] + [(nolabel, Exp.fun_ nolabel None punit e)] ) #endif );