Fix warnings with OCaml 4.11

This commit is contained in:
Kate 2020-05-08 13:45:39 +01:00 committed by ZAN DoYe
parent 471cb31115
commit 1da1f64765
2 changed files with 5 additions and 5 deletions

View File

@ -924,7 +924,7 @@ let complete ~phrase_terminator ~input =
| [(Symbol "#", _); (Lident "typeof", _); (String (tlen, false), loc)] -> | [(Symbol "#", _); (Lident "typeof", _); (String (tlen, false), loc)] ->
let prefix = String.sub input (loc.ofs1 + tlen) (String.length input - loc.ofs1 - tlen) in let prefix = String.sub input (loc.ofs1 + tlen) (String.length input - loc.ofs1 - tlen) in
begin match Longident.parse prefix with begin match Longident.parse prefix [@ocaml.warning "-3"] with
| Longident.Ldot (lident, last_prefix) -> | Longident.Ldot (lident, last_prefix) ->
let set = names_of_module lident in let set = names_of_module lident in
let compls = lookup last_prefix (String_set.elements set) in let compls = lookup last_prefix (String_set.elements set) in

View File

@ -439,7 +439,7 @@ type rewrite_rule = {
let longident_lwt_main_run = Longident.Ldot (Longident.Lident "Lwt_main", "run") let longident_lwt_main_run = Longident.Ldot (Longident.Lident "Lwt_main", "run")
let longident_async_thread_safe_block_on_async_exn = let longident_async_thread_safe_block_on_async_exn =
Longident.parse "Async.Thread_safe.block_on_async_exn" Longident.(Ldot (Ldot (Lident "Async", "Thread_safe"), "block_on_async_exn"))
let longident_unit = Longident.Lident "()" let longident_unit = Longident.Lident "()"
#if OCAML_VERSION >= (4, 03, 0) #if OCAML_VERSION >= (4, 03, 0)
@ -451,7 +451,7 @@ let nolabel = ""
let rewrite_rules = [ let rewrite_rules = [
(* Rewrite Lwt.t expressions to Lwt_main.run <expr> *) (* Rewrite Lwt.t expressions to Lwt_main.run <expr> *)
{ {
type_to_rewrite = Longident.parse "Lwt.t"; type_to_rewrite = Longident.(Ldot (Lident "Lwt", "t"));
path_to_rewrite = None; path_to_rewrite = None;
required_values = [longident_lwt_main_run]; required_values = [longident_lwt_main_run];
rewrite = (fun loc e -> rewrite = (fun loc e ->
@ -466,7 +466,7 @@ let rewrite_rules = [
(* Rewrite Async.Defered.t expressions to (* Rewrite Async.Defered.t expressions to
Async.Thread_safe.block_on_async_exn (fun () -> <expr>). *) Async.Thread_safe.block_on_async_exn (fun () -> <expr>). *)
{ {
type_to_rewrite = Longident.parse "Async.Deferred.t"; type_to_rewrite = Longident.(Ldot (Ldot (Lident "Async", "Deferred"), "t"));
path_to_rewrite = None; path_to_rewrite = None;
required_values = [longident_async_thread_safe_block_on_async_exn]; required_values = [longident_async_thread_safe_block_on_async_exn];
rewrite = (fun loc e -> rewrite = (fun loc e ->
@ -1182,7 +1182,7 @@ end
+-----------------------------------------------------------------+ *) +-----------------------------------------------------------------+ *)
let typeof sid = let typeof sid =
let id = Longident.parse sid in let id = Longident.parse sid [@ocaml.warning "-3"] in
let env = !Toploop.toplevel_env in let env = !Toploop.toplevel_env in
#if OCAML_VERSION >= (4, 10, 0) #if OCAML_VERSION >= (4, 10, 0)
let lookup_value= Env.find_value_by_name let lookup_value= Env.find_value_by_name