Markus Mottl avatar Markus Mottl committed cb9a6e0

Fixed warnings

Comments (0)

Files changed (5)

base/sexplib/lib/conv.ml

         | Parse_error pe ->
             let ppos =
               match pe.parse_state with
-              | `Sexp { parse_pos } | `Annot { parse_pos } -> parse_pos
+              | `Sexp { parse_pos; _ } | `Annot { parse_pos; _ } -> parse_pos
             in
             List [
               Atom "Sexplib.Sexp.Parse_error";

base/sexplib/lib/pre_sexp.ml

 let get_main_buf buf =
   let buf =
     match buf with
-    | None -> Buffer.create 64
+    | None -> Buffer.create 128
     | Some buf -> buf in
   Lexer.main ~buf
 
 
 exception Parse_error of parse_error
 
-let bump_text_line { parse_pos } =
+let bump_text_line { parse_pos; _ } =
   parse_pos.Parse_pos.text_line <- parse_pos.Parse_pos.text_line + 1;
   parse_pos.Parse_pos.text_char <- 0
 
-let bump_text_pos { parse_pos } =
+let bump_text_pos { parse_pos; _ } =
   parse_pos.Parse_pos.text_char <- parse_pos.Parse_pos.text_char + 1
 
 let bump_pos_cont state str ~max_pos ~pos cont =
   parse_pos.Parse_pos.buf_pos <- buf_pos;
   parse_pos.Parse_pos.global_offset <- parse_pos.Parse_pos.global_offset + len
 
-let mk_parse_pos { parse_pos } buf_pos =
+let mk_parse_pos { parse_pos; _ } buf_pos =
   set_parse_pos parse_pos buf_pos;
   parse_pos
 
 let raise_parse_error parse_state location buf_pos err_msg =
   begin
     match parse_state with
-    | `Sexp { parse_pos } | `Annot { parse_pos } ->
+    | `Sexp { parse_pos; _ } | `Annot { parse_pos; _ } ->
         set_parse_pos parse_pos buf_pos;
         parse_pos.Parse_pos.text_char <- parse_pos.Parse_pos.text_char + 1;
   end;
   parse_pos.Parse_pos.global_offset + pos - parse_pos.Parse_pos.buf_pos
 
 let mk_annot_pos
-      ({ Parse_pos.text_line = line; text_char = col } as parse_pos) pos =
+      ({ Parse_pos.text_line = line; text_char = col; _ } as parse_pos) pos =
   { Annot.line; col; offset = get_glob_ofs parse_pos pos }
 
 let mk_annot_pos1
-      ({ Parse_pos.text_line = line; text_char = col } as parse_pos) pos =
+      ({ Parse_pos.text_line = line; text_char = col; _ } as parse_pos) pos =
   { Annot.line; col = col + 1; offset = get_glob_ofs parse_pos pos }
 
-let add_annot_pos { parse_pos; pstack } pos =
+let add_annot_pos { parse_pos; pstack; _ } pos =
   pstack.Annot.positions <- mk_annot_pos parse_pos pos :: pstack.Annot.positions
 
-let add_annot_pos1 { parse_pos; pstack } pos =
+let add_annot_pos1 { parse_pos; pstack; _ } pos =
   pstack.Annot.positions <-
     mk_annot_pos1 parse_pos pos :: pstack.Annot.positions
 
-let get_annot_range { parse_pos; pstack } pos =
+let get_annot_range { parse_pos; pstack; _ } pos =
   let start_pos =
     match pstack.Annot.positions with
     | [] -> assert false  (* impossible *)
   let rec loop this_parse ~pos ~len ~is_incomplete =
     if len > 0 then
       match this_parse ~pos ~len buf with
-      | Done (sexp, ({ Parse_pos.buf_pos } as parse_pos)) ->
+      | Done (sexp, ({ Parse_pos.buf_pos; _ } as parse_pos)) ->
           rev_sexps_ref := sexp :: !rev_sexps_ref;
           let n_parsed = buf_pos - pos in
           let this_parse = mk_this_parse ~parse_pos my_parse in
 
 let of_string_bigstring loc this_parse ws_buf get_len get_sub str =
   match this_parse str with
-  | Done (_, { Parse_pos.buf_pos }) when buf_pos <> get_len str ->
+  | Done (_, { Parse_pos.buf_pos; _ }) when buf_pos <> get_len str ->
       let prefix_len = min (get_len str - buf_pos) 20 in
       let prefix = get_sub str buf_pos prefix_len in
       let msg =
       failwith (sprintf "Sexplib.Sexp.gen_load_sexp: end of file: %s" file)
     else
       match this_parse ~pos:0 ~len buf with
-      | Done (sexp, ({ Parse_pos.buf_pos } as parse_pos))
+      | Done (sexp, ({ Parse_pos.buf_pos; _ } as parse_pos))
         when strict ->
           let rec strict_loop this_parse ~pos ~len =
             match this_parse ~pos ~len buf with
 
   let get_conv_exn ~file ~exc annot_sexp =
     let range = get_range annot_sexp in
-    let { start_pos = { line; col } } = range in
+    let { start_pos = { line; col; _ }; _ } = range in
     let loc = sprintf "%s:%d:%d" file line col in
     Of_sexp_error (Annot.Conv_exn (loc, exc), get_sexp annot_sexp)
 end

base/sexplib/lib_test/conv_test.ml

 
 type labeled = string -> foo : unit -> ?bar : int -> float -> float with sexp
 
-let f str ~foo ?(bar = 3) n = float_of_string str +. n +. float bar
+let f str ~foo:_ ?(bar = 3) n = float_of_string str +. n +. float bar
 
 let labeled_sexp : Sexp.t = sexp_of_labeled f
 let labeled : labeled lazy_t = lazy (labeled_of_sexp (labeled_sexp : Sexp.t))

base/sexplib/oasis.sh

             (S [A "-ppopt"; P "syntax/pa_sexp_conv.cma"]);
           flag ["compile"; "ocaml"; "use_pa_sexp_conv"]
             (S [A "-ppopt"; P "syntax/pa_sexp_conv.cma"]);
+          flag ["compile"; "ocaml"] (S [A "-w"; A "@Ae" ]);
           dispatch_default e
       | e -> dispatch_default e
   end

base/sexplib/syntax/pa_sexp_conv.ml

   let () =
     Pa_type_conv.add_record_generator "sexp_drop_default" (fun loc ->
       check_record_field_handler loc;
-      Hashtbl.replace record_field_handlers loc `drop_default)
+      Hashtbl.replace record_field_handlers ~key:loc ~data:`drop_default)
 
   let () =
     Pa_type_conv.add_record_generator_with_arg "sexp_drop_if"
           | Some expr -> expr
           | None -> Loc.raise loc (Failure "could not parse expression")
         in
-        Hashtbl.replace record_field_handlers loc (`drop_if test))
+        Hashtbl.replace record_field_handlers ~key:loc ~data:(`drop_if test))
 
   (* Make abstract calls *)
   let mk_abst_call loc tn rev_path =
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.