Skip to content

Commit

Permalink
[ocaml] upgrade most dependencies
Browse files Browse the repository at this point in the history
Summary:
newer is better, right?

All the code changes in infer are because of core being bumped to v0.12.

Reviewed By: jberdine

Differential Revision: D16223183

fbshipit-source-id: f3c339966
  • Loading branch information
jvillard authored and facebook-github-bot committed Jul 15, 2019
1 parent 5882c49 commit 128f379
Show file tree
Hide file tree
Showing 25 changed files with 100 additions and 124 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ endif
# This is a magical version number that doesn't reinstall the world when added on top of what we
# have in opam.locked. To upgrade this version number, manually try to install several utop versions
# until you find one that doesn't recompile the world. TODO(t20828442): get rid of magic
OPAM_DEV_DEPS = ocamlformat.$$(grep version .ocamlformat | cut -d ' ' -f 3) ocp-indent merlin utop.2.2.0 webbrowser
OPAM_DEV_DEPS = ocamlformat.$$(grep version .ocamlformat | cut -d ' ' -f 3) ocp-indent merlin utop.2.4.0 webbrowser

ifneq ($(EMACS),no)
OPAM_DEV_DEPS += tuareg
Expand Down
1 change: 0 additions & 1 deletion infer/src/IR/Attributes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ let store ~proc_desc (attr : ProcAttributes.t) =
(Option.map proc_desc ~f:Procdesc.get_static_callees |> Option.value ~default:[])



let load_defined pname = Typ.Procname.SQLite.serialize pname |> find ~defined:true

let find_file_capturing_procedure pname =
Expand Down
2 changes: 1 addition & 1 deletion infer/src/IR/Ident.ml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ end)
let hashqueue_of_sequence ?init s =
let q = match init with None -> HashQueue.create () | Some q0 -> q0 in
Sequence.iter s ~f:(fun id ->
let (_ : [`Key_already_present | `Ok]) = HashQueue.enqueue q id () in
let (_ : [`Key_already_present | `Ok]) = HashQueue.enqueue_back q id () in
() ) ;
q

Expand Down
1 change: 1 addition & 0 deletions infer/src/IR/Mangled.ml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ let rename ~f {plain; mangled} =
let mangled = Option.map ~f mangled in
{plain; mangled}


module Set = Caml.Set.Make (struct
type nonrec t = t

Expand Down
2 changes: 1 addition & 1 deletion infer/src/IR/ProcnameDispatcher.ml
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ module Call = struct
-> 'marker
-> ('context, 'captured_types, 'markers) one_arg_matcher =
fun get_m get_c marker ->
let marker_static_checker markers = Polymorphic_compare.( = ) marker (get_m markers) in
let marker_static_checker markers = Poly.equal marker (get_m markers) in
let match_arg _context capt arg = Typ.equal (FuncArg.typ arg) (get_c capt) in
{match_arg; marker_static_checker}

Expand Down
2 changes: 1 addition & 1 deletion infer/src/backend/StatsAggregator.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let find_json_files_in_dir dir =
let json_regex = Str.regexp_case_fold ".*\\.json$" in
(not (Str.string_match json_files_to_ignore_regex path 0))
&& Str.string_match json_regex path 0
&& Polymorphic_compare.( = ) s.st_kind Unix.S_REG
&& Poly.equal s.st_kind Unix.S_REG
in
match dir_exists dir with
| true ->
Expand Down
3 changes: 1 addition & 2 deletions infer/src/base/Utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@ let create_dir dir =
with Unix.Unix_error _ ->
let created_concurrently =
(* check if another process created it meanwhile *)
try Polymorphic_compare.( = ) (Unix.stat dir).Unix.st_kind Unix.S_DIR
with Unix.Unix_error _ -> false
try Poly.equal (Unix.stat dir).Unix.st_kind Unix.S_DIR with Unix.Unix_error _ -> false
in
if not created_concurrently then L.(die ExternalError) "cannot create directory '%s'" dir )

Expand Down
8 changes: 5 additions & 3 deletions infer/src/biabduction/Match.ml
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@ let exp_list_match es1 sub vars es2 =
| Some (sub_acc, vars_leftover) ->
exp_match e1 sub_acc vars_leftover e2
in
Option.find_map
~f:(fun es_combined -> List.fold ~f ~init:(Some (sub, vars)) es_combined)
(List.zip es1 es2)
match List.zip es1 es2 with
| Ok es_combined ->
List.fold ~f ~init:(Some (sub, vars)) es_combined
| Unequal_lengths ->
None


(** Checks [sexp1 = sexp2[sub ++ sub']] for some [sub'] with
Expand Down
2 changes: 1 addition & 1 deletion infer/src/biabduction/State.ml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ let mk_find_duplicate_nodes : Procdesc.t -> Procdesc.Node.t -> Procdesc.NodeSet.
let s = M.find (get_key node) map in
let node_normalized_instrs = Procdesc.NodeMap.find node s in
let collect_duplicates node' normalized_instrs' nset =
if List.equal ~equal:Sil.equal_instr node_normalized_instrs normalized_instrs' then
if List.equal Sil.equal_instr node_normalized_instrs normalized_instrs' then
Procdesc.NodeSet.add node' nset
else nset
in
Expand Down
4 changes: 2 additions & 2 deletions infer/src/clang/cFrontend_errors.ml
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,11 @@ let expand_formula phi map_ error_msg_ =
| false, fparams, f1 -> (
(* in this case it should be a defined macro *)
match List.zip fparams actual_param with
| Some sub ->
| Ok sub ->
let f1_sub = apply_substitution f1 sub in
let map' = ALVar.FormulaIdMap.add av (true, fparams, f1) map in
expand f1_sub map' error_msg'
| None ->
| Unequal_lengths ->
L.(die ExternalError)
"Formula identifier '%s' is not called with the right number of parameters" name
)
Expand Down
10 changes: 5 additions & 5 deletions infer/src/clang/cTL.ml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ type al_file =
; global_paths: (string * ALVar.alexp list) list
; checkers: ctl_checker list }

let equal_ast_node = Poly.( = )
let equal_ast_node = Poly.equal

module Debug = struct
let pp_transition fmt trans_opt =
Expand Down Expand Up @@ -817,12 +817,12 @@ let parameter_of_corresp_name method_name args name =
List.filter (String.split ~on:':' method_name) ~f:(fun label -> not (String.is_empty label))
in
match List.zip names args with
| Some names_args -> (
| Ok names_args -> (
let names_arg_opt =
List.find names_args ~f:(fun (arg_label, _) -> ALVar.compare_str_with_alexp arg_label name)
in
match names_arg_opt with Some (_, arg) -> Some arg | None -> None )
| None ->
| Unequal_lengths ->
None


Expand Down Expand Up @@ -911,10 +911,10 @@ let field_of_corresp_name_from_init_list_expr name init_nodes (expr_info : Clang
| Some decl -> (
let fields = transition_via_fields (Decl decl) in
match List.zip init_nodes fields with
| Some init_nodes_fields ->
| Ok init_nodes_fields ->
List.filter ~f:(fun (_, field) -> field_has_name name field) init_nodes_fields
|> List.map ~f:(fun (node, _) -> node)
| None ->
| Unequal_lengths ->
[] )
| None ->
[]
Expand Down
2 changes: 1 addition & 1 deletion infer/src/clang/clang_ast_extend.ml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module TypePointerOrd = struct
| _, Clang_ast_types.TypePtr.Ptr _ ->
-1
| Builtin a, Builtin b ->
Polymorphic_compare.compare a b
Poly.compare a b
| Builtin _, _ ->
1
| _, Builtin _ ->
Expand Down
29 changes: 2 additions & 27 deletions infer/src/integration/Clang.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,10 @@
* LICENSE file in the root directory of this source tree.
*)
open! IStd
module F = Format
module L = Logging

type compiler = Clang | Make [@@deriving compare]

let pp_extended_env fmt (env : Unix.env) =
let pp_pair fmt (var, value) = F.fprintf fmt "%s=%s" var value in
match env with
| `Replace values ->
F.fprintf fmt "@[<v>%a@]" (Pp.seq ~print_env:Pp.text_break pp_pair) values
| `Extend values ->
let is_extended s =
match String.lsplit2 s ~on:'=' with
| Some (var, _) ->
List.exists ~f:(fun (var', _) -> String.equal var var') values
| None ->
false
in
let env_not_extended =
Unix.environment () |> Array.to_list |> List.filter ~f:(Fn.non is_extended)
in
F.fprintf fmt "@[<v>%a@ %a@]"
(Pp.seq ~print_env:Pp.text_break F.pp_print_string)
env_not_extended
(Pp.seq ~print_env:Pp.text_break pp_pair)
values
| `Replace_raw values ->
F.fprintf fmt "@[<v>%a@]" (Pp.seq ~print_env:Pp.text_break F.pp_print_string) values


let capture compiler ~prog ~args =
match compiler with
| Clang ->
Expand All @@ -44,7 +18,8 @@ let capture compiler ~prog ~args =
let old_path = Option.value ~default:"" (Sys.getenv path_var) in
let new_path = Config.wrappers_dir ^ ":" ^ old_path in
let extended_env = `Extend [(path_var, new_path); ("INFER_OLD_PATH", old_path)] in
L.environment_info "Running command %s with env:@\n%a@\n@." prog pp_extended_env extended_env ;
L.environment_info "Running command %s with env:@\n%s@\n@." prog
(Unix.sexp_of_env extended_env |> Sexp.to_string) ;
Unix.fork_exec ~prog ~argv:(prog :: args) ~env:extended_env ()
|> Unix.waitpid
|> function
Expand Down
4 changes: 1 addition & 3 deletions infer/src/istd/ARList.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ type +'a t = Empty | Cons of 'a * 'a t | Snoc of 'a t * 'a | Concat of 'a t * 'a
let () =
(* This is a pretty simple test to check that the runtime representation of OCaml lists is compatible with our lists and hence using [Obj.magic] for [of_list] is legit *)
let exception RuntimeValue in
assert (
Polymorphic_compare.(Caml.Obj.repr [RuntimeValue] = Caml.Obj.repr (Cons (RuntimeValue, Empty)))
)
assert (Poly.(Caml.Obj.repr [RuntimeValue] = Caml.Obj.repr (Cons (RuntimeValue, Empty))))


(* Constructors *)
Expand Down
2 changes: 1 addition & 1 deletion infer/src/istd/MaximumSharing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ end = struct
with type t = Hashing.hash_value * Obj.t )


module HashedNoscanBlock = (val hashed_obj Polymorphic_compare.equal)
module HashedNoscanBlock = (val hashed_obj Poly.equal)

module PhysEqualedHashedScannableBlock = (val hashed_obj phys_equal)

Expand Down
2 changes: 1 addition & 1 deletion infer/src/istd/PolyVariantEqual.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

open! Core

let ( = ) (v1 : [> ]) (v2 : [> ]) = Polymorphic_compare.( = ) v1 v2
let ( = ) (v1 : [> ]) (v2 : [> ]) = Poly.equal v1 v2
2 changes: 1 addition & 1 deletion infer/src/java/jTrans.ml
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ let get_test_operator op =
Binop.Ne


let is_java_native cm = Poly.( = ) cm.Javalib.cm_implementation Javalib.Native
let is_java_native cm = Poly.equal cm.Javalib.cm_implementation Javalib.Native

let is_clone ms = String.equal (JBasics.ms_name ms) JConfig.clone_name

Expand Down
2 changes: 1 addition & 1 deletion infer/src/topl/Topl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ let evaluate_static_guard label (e_fun, arg_ts) =
false
in
let match_args () =
let same_length xs ys = Option.is_some (List.zip xs ys) in
let same_length xs ys = Int.equal (Caml.List.compare_lengths xs ys) 0 in
Option.value_map label.ToplAst.arguments ~f:(same_length arg_ts) ~default:true
in
match_name () && match_args ()
Expand Down
7 changes: 3 additions & 4 deletions infer/src/unit/DifferentialFiltersTests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,11 @@ let test_file_renamings_find_previous =

let test_relative_complements =
let create_test pred (l1, l2) (expected_l1, expected_l2, expected_l3) _ =
let compare = Int.compare in
let output_l1, output_l2, output_l3 =
DifferentialFilters.VISIBLE_FOR_TESTING_DO_NOT_USE_DIRECTLY.relative_complements ~compare
~pred l1 l2
DifferentialFilters.VISIBLE_FOR_TESTING_DO_NOT_USE_DIRECTLY.relative_complements
~compare:Int.compare ~pred l1 l2
in
let list_equal l1 l2 = List.equal ~equal:(fun v1 v2 -> Int.equal (compare v1 v2) 0) l1 l2 in
let list_equal l1 l2 = List.equal Int.equal l1 l2 in
assert_equal ~pp_diff:(pp_diff_of_int_list "First list") ~cmp:list_equal expected_l1 output_l1 ;
assert_equal ~pp_diff:(pp_diff_of_int_list "Second list") ~cmp:list_equal expected_l2 output_l2 ;
assert_equal ~pp_diff:(pp_diff_of_int_list "Third list") ~cmp:list_equal expected_l3 output_l3
Expand Down
6 changes: 3 additions & 3 deletions infer/src/unit/FileDiffTests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let test_unixdiff_process_raw_directives_with_valid_input =
let actual_str = Format.asprintf "%a" (Pp.seq ~sep:"" UnixDiffTest.pp) actual in
Format.fprintf fmt "Expected: '%s', found: '%s'" expected_str actual_str
in
assert_equal ~cmp:(List.equal ~equal:UnixDiffTest.equal) ~pp_diff expected found
assert_equal ~cmp:(List.equal UnixDiffTest.equal) ~pp_diff expected found
in
[ ( "test_unixdiff_process_raw_directives_1"
, "UOOU"
Expand Down Expand Up @@ -78,7 +78,7 @@ let test_parse_directives_with_valid_input =
let actual_str = Format.asprintf "%a" (Pp.seq ~sep:", " Format.pp_print_int) actual in
Format.fprintf fmt "Expected: '%s', found: '%s'" expected_str actual_str
in
assert_equal ~cmp:(List.equal ~equal:Int.equal) ~pp_diff expected found
assert_equal ~cmp:(List.equal Int.equal) ~pp_diff expected found
in
[ (*
=== test1 ===
Expand Down Expand Up @@ -251,7 +251,7 @@ let test_parse_unix_diff_with_valid_input =
let actual_str = Format.asprintf "%a" (Pp.seq ~sep:", " Format.pp_print_int) actual in
Format.fprintf fmt "Expected: '%s', found: '%s'" expected_str actual_str
in
assert_equal ~cmp:(List.equal ~equal:Int.equal) ~pp_diff expected found
assert_equal ~cmp:(List.equal Int.equal) ~pp_diff expected found
in
[("test_parse_unix_diff_1", "OONUU", [1]); ("test_parse_unix_diff_2", "UOONUONN", [2; 4; 5])]
|> List.map ~f:(fun (name, test_input, expected_output) ->
Expand Down
6 changes: 2 additions & 4 deletions infer/src/unit/JavaProfilerSamplesTest.ml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ let test_jni_parse_str_with_valid_input =
Format.fprintf fmt "Expected: '%a', found: '%a'" (Format.pp_print_list T.pp) expected
(Format.pp_print_list T.pp) actual
in
assert_equal ~cmp:(List.equal ~equal:T.equal) ~pp_diff expected found
assert_equal ~cmp:(List.equal T.equal) ~pp_diff expected found
in
[ ( "test_jni_parse_str_with_method_signature"
, "(IZLjava/lang/String;)[C"
Expand Down Expand Up @@ -160,9 +160,7 @@ let test_jni_to_java_type_with_invalid_input =
let test_from_json_string_with_valid_input =
let create_test input expected ~use_signature _ =
let found = JavaProfilerSamples.from_json_string input ~use_signature in
assert_equal
~cmp:(List.equal ~equal:JavaProfilerSamples.equal_labeled_profiler_sample)
expected found
assert_equal ~cmp:(List.equal JavaProfilerSamples.equal_labeled_profiler_sample) expected found
in
let input1 = "[{\"test\": \"label1\",\"methods\": []}]" in
let expected1 = [("label1", JavaProfilerSamples.ProfilerSample.of_list [])] in
Expand Down
2 changes: 1 addition & 1 deletion infer/src/unit/MaximumSharingTests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ let tests =
let serialized_normalized_with_sharing = Marshal.to_string normalized [] in
assert_equal serialized_input_with_sharing serialized_normalized_with_sharing
| `MarshalNoSharing_MustBeBetter ->
assert_bool "equal" (Polymorphic_compare.equal input normalized) ;
assert_bool "equal" (Poly.equal input normalized) ;
assert_bool "strictly less reachable words"
(reachable_words_normalized < reachable_words_input) ;
(*
Expand Down
2 changes: 1 addition & 1 deletion infer/src/unit/procCfgTests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ let tests =
let open OUnit2 in
let cmp l1 l2 =
let sort = List.sort ~compare:Procdesc.Node.compare in
List.equal ~equal:Procdesc.Node.equal (sort l1) (sort l2)
List.equal Procdesc.Node.equal (sort l1) (sort l2)
in
let pp_diff fmt (actual, expected) =
let pp_sep fmt _ = F.pp_print_char fmt ',' in
Expand Down
6 changes: 3 additions & 3 deletions opam
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ depends: [
"atdgen" {>="2.0.0"}
"base64" {>="3.0.0"}
"cmdliner" {>="1.0.0"}
"core" {<"v0.12.0"}
"core" {>="v0.12.0" & < "v0.13"}
"conf-autoconf" {build}
"conf-gmp" {build}
"conf-mpfr" {build}
Expand All @@ -34,15 +34,15 @@ depends: [
"ctypes" {>="0.9.2"}
"dune" {build & >="1.0"}
"elina" {>="1.1"}
"javalib" {>="2.3.5" & <"3.0"}
"javalib" {="3.0"}
"mtime"
"ocaml" {>="4.06.0"}
"ocamlfind" {build}
"ocamlgraph"
"ounit" {>="2.0.5"}
"parmap" {>="1.0-rc8"}
"ppx_deriving" {>="4.1"}
"ppx_fields_conv" {>="v0.11.0" & < "v0.12"}
"ppx_fields_conv" {>="v0.12.0" & < "v0.13"}
"sawja" {>="1.5.4"}
"sqlite3"
"utop" {with-test}
Expand Down
Loading

0 comments on commit 128f379

Please sign in to comment.