Skip to content

Commit

Permalink
[ocamlformat] Update ocamlformat to version 0.22 + fixes
Browse files Browse the repository at this point in the history
Summary:
Update ocamlformat version to 0.22 plus a few fixes. Source is from
the branch https://github.com/ocaml-ppx/ocamlformat#nebuchadnezzar,
and in particular commit 839cc56f4cf152fac3216039d847cf4c7763cb79.

Reviewed By: jvillard

Differential Revision: D37473266

fbshipit-source-id: b253544fed4a8d23d791c49901fe3c03d1b2c73a
  • Loading branch information
jberdine authored and facebook-github-bot committed Jun 30, 2022
1 parent f521c2f commit df7b7d2
Show file tree
Hide file tree
Showing 30 changed files with 66 additions and 67 deletions.
1 change: 1 addition & 0 deletions dependencies/ocamldot/.ocamlformat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
disable=true
3 changes: 2 additions & 1 deletion infer/src/.ocamlformat
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
version = 0.19.0-25-gfae9197
ocaml-version = 4.14
version = 0.22.4-3-g839cc56
profile = ocamlformat
break-before-in = fit-or-vertical
break-sequences = true
Expand Down
3 changes: 2 additions & 1 deletion infer/src/IR/Textual.mli
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* LICENSE file in the root directory of this source tree.
*)

type name (* textual name *)
(** textual name *)
type name

val name_of_string : string -> name

Expand Down
1 change: 1 addition & 0 deletions infer/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ $(GENERATED_FROM_AUTOCONF): $(MAKEFILE_LIST)
-e "s|@INFER_MAN_LAST_MODIFIED[@]|$(INFER_MAN_LAST_MODIFIED)|g" \
$@.in > "$$TMPFILE"; \
cat "$$TMPFILE" > $@; \
echo -e "\n;;" >> $@; \
$(REMOVE) "$$TMPFILE"
dune.common: dune.common.in
../dune-workspace: ../dune-workspace.in
Expand Down
2 changes: 1 addition & 1 deletion infer/src/absint/ProcnameDispatcher.mli
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ module Call : sig
include
Common
with type ('context, 'f, 'arg_payload) dispatcher =
'context -> Procname.t -> 'arg_payload FuncArg.t list -> 'f option
'context -> Procname.t -> 'arg_payload FuncArg.t list -> 'f option

val merge_dispatchers :
('context, 'f, 'arg_payload) dispatcher
Expand Down
4 changes: 3 additions & 1 deletion infer/src/base/CommandDoc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ let mk_command_doc ~see_also:see_also_commands ?environment:environment_opt ?fil
Cmdliner.Manpage.s_files section ) ]
in
CLOpt.mk_command_doc ~section ~version:Version.versionString
~date:Version.man_pages_last_modify_date ~synopsis:[`Pre synopsis] ~environment ~files ?see_also
~date:Version.man_pages_last_modify_date
~synopsis:[`Pre synopsis]
~environment ~files ?see_also


let analyze =
Expand Down
5 changes: 3 additions & 2 deletions infer/src/base/CommandLineOption.mli
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@ val mk_command_doc :
-> string
-> command_doc
(** [mk_command_doc ~title ~section ~version ~short_description ~synopsis ~description ~see_also
command_exe] records information about a command that is used to create its man page. A lot of
the concepts are taken from man-pages(7).
command_exe]
records information about a command that is used to create its man page. A lot of the concepts
are taken from man-pages(7).
- [command_exe] is the name of the command, preferably an executable that selects the command
- [title] will be the title of the manual
Expand Down
6 changes: 2 additions & 4 deletions infer/src/base/Config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1956,8 +1956,7 @@ and nullsafe_disable_field_not_initialized_in_nonstrict_classes =

and nullsafe_optimistic_third_party_in_default_mode =
CLOpt.mk_bool
~long:
"nullsafe-optimistic-third-party-in-default-mode"
~long:"nullsafe-optimistic-third-party-in-default-mode"
(* Turned on for compatibility reasons
*)
~default:true
Expand Down Expand Up @@ -2963,8 +2962,7 @@ and xcpretty =

let javac_classes_out =
CLOpt.mk_string ~parse_mode:CLOpt.Javac ~deprecated:["classes_out"] ~long:""
~short:
'd'
~short:'d'
(* Ensure that some form of "-d ..." is passed to javac. It's unclear whether this is strictly
needed but the tests break without this for now. See discussion in D4397716. *)
~default:CLOpt.init_work_dir
Expand Down
18 changes: 11 additions & 7 deletions infer/src/base/IssueType.ml
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,8 @@ let eradicate_field_not_nullable =
(* Very non-precise issue. Should be actually turned off unless for experimental purposes. *)
let eradicate_field_over_annotated =
register ~id:"ERADICATE_FIELD_OVER_ANNOTATED" ~hum:"Field Over Annotated" Advice
Eradicate (* TODO *) ~user_documentation:""
Eradicate (* TODO *)
~user_documentation:""


let eradicate_inconsistent_subclass_parameter_annotation =
Expand All @@ -581,7 +582,8 @@ let eradicate_inconsistent_subclass_return_annotation =

let eradicate_redundant_nested_class_annotation =
register ~id:"ERADICATE_REDUNDANT_NESTED_CLASS_ANNOTATION"
~hum:"@Nullsafe annotation is redundant" Advice Eradicate (* TODO *) ~user_documentation:""
~hum:"@Nullsafe annotation is redundant" Advice Eradicate (* TODO *)
~user_documentation:""


let eradicate_bad_nested_class_annotation =
Expand All @@ -592,7 +594,8 @@ let eradicate_bad_nested_class_annotation =

let eradicate_nullable_dereference =
register ~id:"ERADICATE_NULLABLE_DEREFERENCE" ~hum:"Nullable Dereference" Warning
Eradicate (* TODO *) ~user_documentation:""
Eradicate (* TODO *)
~user_documentation:""


let eradicate_parameter_not_nullable =
Expand Down Expand Up @@ -630,7 +633,8 @@ let eradicate_meta_class_is_nullsafe =
register ~id:"ERADICATE_META_CLASS_IS_NULLSAFE"
~hum:
"Class is marked @Nullsafe and has 0 issues" (* Should be enabled for special integrations *)
~enabled:false Info Eradicate (* TODO *) ~user_documentation:""
~enabled:false Info Eradicate (* TODO *)
~user_documentation:""


let eradicate_meta_class_needs_improvement =
Expand All @@ -644,9 +648,9 @@ let eradicate_meta_class_needs_improvement =

let eradicate_meta_class_can_be_nullsafe =
register ~id:"ERADICATE_META_CLASS_CAN_BE_NULLSAFE"
~hum:
"Class has 0 issues and can be marked @Nullsafe"
(* Should be enabled for special integrations *) ~enabled:false Advice Eradicate (* TODO *)
~hum:"Class has 0 issues and can be marked @Nullsafe"
(* Should be enabled for special integrations *)
~enabled:false Advice Eradicate (* TODO *)
~user_documentation:""


Expand Down
6 changes: 4 additions & 2 deletions infer/src/biabduction/Prop.ml
Original file line number Diff line number Diff line change
Expand Up @@ -508,12 +508,14 @@ let replace_array_contents (hpred : Predicates.hpred) esel : Predicates.hpred =
let rec pi_sorted_remove_redundant (pi : pi) =
match pi with
| (Aeq (BinOp (Le, e1, Const (Cint n1)), Const (Cint i1)) as a1)
:: Aeq (BinOp (Le, e2, Const (Cint n2)), Const (Cint i2)) :: rest
:: Aeq (BinOp (Le, e2, Const (Cint n2)), Const (Cint i2))
:: rest
when IntLit.isone i1 && IntLit.isone i2 && Exp.equal e1 e2 && IntLit.lt n1 n2 ->
(* second inequality redundant *)
pi_sorted_remove_redundant (a1 :: rest)
| Aeq (BinOp (Lt, Const (Cint n1), e1), Const (Cint i1))
:: (Aeq (BinOp (Lt, Const (Cint n2), e2), Const (Cint i2)) as a2) :: rest
:: (Aeq (BinOp (Lt, Const (Cint n2), e2), Const (Cint i2)) as a2)
:: rest
when IntLit.isone i1 && IntLit.isone i2 && Exp.equal e1 e2 && IntLit.lt n1 n2 ->
(* first inequality redundant *)
pi_sorted_remove_redundant (a2 :: rest)
Expand Down
2 changes: 1 addition & 1 deletion infer/src/cost/costInstantiate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ let prepare_call_args
in
let get_callee_cost_summary_and_formals callee_pname =
let* callee_pdesc, (_inferbo, _, callee_costs_summary) = analyze_dependency callee_pname in
let+ callee_costs_summary = callee_costs_summary in
let+ callee_costs_summary in
(callee_costs_summary, Procdesc.get_pvar_formals callee_pdesc)
in
let inferbo_get_summary callee_pname =
Expand Down
1 change: 1 addition & 0 deletions infer/src/datalog/scan_jar/.ocamlformat
1 change: 0 additions & 1 deletion infer/src/infertop.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
* LICENSE file in the root directory of this source tree.
*)

;;
UTop_main.main ()
4 changes: 3 additions & 1 deletion infer/src/istd/PhysEqual.mli
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ open! IStd
Simply write
{[ PhysEqual.optim2 ~res:(construct (f a b)) a0 b0 ]} *)
{[
PhysEqual.optim2 ~res:(construct (f a b)) a0 b0
]} *)

val optim1 : res:'a -> 'a -> 'a

Expand Down
15 changes: 5 additions & 10 deletions infer/src/nullsafe/unit/ThirdPartyAnnotationInfoTests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ let basic_find =
(* Make sure we can find what we just stored *)
assert_has_nullability_info storage
{class_name= "a.A"; method_name= Method "foo"; param_types= ["b.B"]}
~expected_nullability:(Nonnull, [Nonnull])
~expected_file:"test.sig" ~expected_line:1 ;
~expected_nullability:(Nonnull, [Nonnull]) ~expected_file:"test.sig" ~expected_line:1 ;
assert_has_nullability_info storage
{class_name= "b.B"; method_name= Method "bar"; param_types= ["c.C"; "d.D"]}
~expected_nullability:(Nullable, [Nonnull; Nullable])
Expand Down Expand Up @@ -114,8 +113,7 @@ let disregards_whitespace_lines_and_comments =
in
assert_has_nullability_info storage
{class_name= "a.A"; method_name= Method "foo"; param_types= ["b.B"]}
~expected_nullability:(Nonnull, [Nonnull])
~expected_file:"test.sig" ~expected_line:2 ;
~expected_nullability:(Nonnull, [Nonnull]) ~expected_file:"test.sig" ~expected_line:2 ;
(* Commented out signatures should be ignored *)
assert_no_info storage {class_name= "a.A"; method_name= Method "bar"; param_types= ["b.B"]}

Expand Down Expand Up @@ -198,20 +196,17 @@ let can_add_several_files =
in
assert_has_nullability_info storage
{class_name= "a.A"; method_name= Method "foo"; param_types= ["b.B"]}
~expected_nullability:(Nonnull, [Nonnull])
~expected_file:"file1.sig" ~expected_line:1 ;
~expected_nullability:(Nonnull, [Nonnull]) ~expected_file:"file1.sig" ~expected_line:1 ;
(* 2. Add another file and check if we added info *)
let file2 = ["e.E#baz(f.F)"; "g.G#<init>(h.H, @Nullable i.I) @Nullable"] in
let storage = add_from_annot_file_and_check_success storage ~filename:"file2.sig" ~lines:file2 in
assert_has_nullability_info storage
{class_name= "e.E"; method_name= Method "baz"; param_types= ["f.F"]}
~expected_nullability:(Nonnull, [Nonnull])
~expected_file:"file2.sig" ~expected_line:1 ;
~expected_nullability:(Nonnull, [Nonnull]) ~expected_file:"file2.sig" ~expected_line:1 ;
(* 3. Ensure we did not forget the content from the first file *)
assert_has_nullability_info storage
{class_name= "a.A"; method_name= Method "foo"; param_types= ["b.B"]}
~expected_nullability:(Nonnull, [Nonnull])
~expected_file:"file1.sig" ~expected_line:1
~expected_nullability:(Nonnull, [Nonnull]) ~expected_file:"file1.sig" ~expected_line:1


let should_not_forgive_unparsable_strings =
Expand Down
1 change: 0 additions & 1 deletion infer/src/opensource/dune.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

(* include the open-source modules only in open-source build modes, otherwise this library is empty *)

;;
Jbuild_plugin.V1.send
(Format.sprintf {|
(library
Expand Down
3 changes: 1 addition & 2 deletions infer/src/pulse/Pulse.ml
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,7 @@ module PulseTransferFunctions = struct
Option.value ~default:[default_astate] astates )
in
(astates, !ret_vars) )
ref_counts
([ContinueProgram astate], [])
ref_counts ([ContinueProgram astate], [])


(* In the case of variables that point to Objective-C classes for which we have a dynamic type, we
Expand Down
7 changes: 4 additions & 3 deletions infer/src/pulse/PulseAttribute.ml
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@ module Attribute = struct
| MustBeValid of Timestamp.t * Trace.t * Invalidation.must_be_valid_reason option
| MustNotBeTainted of MustNotBeTaintedSet.t
| JavaResourceReleased
| PropagateTaintFrom of taint_in list (* [v -> PropagateTaintFrom \[v1; ..; vn\]] does not
retain [v1] to [vn], in fact they should be collected
when they become unreachable *)
| PropagateTaintFrom of taint_in list
(* [v -> PropagateTaintFrom \[v1; ..; vn\]] does not
retain [v1] to [vn], in fact they should be collected
when they become unreachable *)
| RefCounted
| SourceOriginOfCopy of {source: AbstractValue.t; is_const_ref: bool}
| StdMoved
Expand Down
4 changes: 2 additions & 2 deletions infer/src/pulse/PulseDecompiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ let find v decompiler =


let add_var_source v var decompiler =
let+ decompiler = decompiler in
let+ decompiler in
if Var.appears_in_source_code var then
let[@warning "-8"] (Var.ProgramVar pvar) = var in
Map.add v (PVar pvar, []) decompiler
Expand Down Expand Up @@ -270,7 +270,7 @@ let replace_getter_call_with_property_access procname v call actuals decompiler


let add_call_source v (call : CallEvent.t) actuals decompiler =
let+ decompiler = decompiler in
let+ decompiler in
match call with
| CallEvent.Call procname | SkippedKnownCall procname -> (
match Attributes.load procname with
Expand Down
4 changes: 2 additions & 2 deletions infer/src/pulse/PulseFormula.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2079,15 +2079,15 @@ module DynamicTypes = struct
let both = {phi.both with term_eqs= Term.VarMap.empty; atoms= Atom.Set.empty} in
let* both, new_eqs =
let f t v acc_both =
let* acc_both = acc_both in
let* acc_both in
let t = simplify_term t in
Formula.Normalizer.and_var_term v t acc_both
in
Term.VarMap.fold f old_term_eqs (Sat (both, []))
in
let+ both, new_eqs =
let f atom acc_both =
let* acc_both = acc_both in
let* acc_both in
let atom = simplify_atom atom in
Formula.Normalizer.and_atom atom acc_both
in
Expand Down
3 changes: 2 additions & 1 deletion infer/src/pulse/PulseModelsImport.ml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ module Basic = struct
L.d_printfln "Found destructor for class %a@\n" Typ.Name.pp class_name ;
PulseCallOperations.call tenv path ~caller_proc_desc:proc_desc
~callee_data:(analyze_dependency destructor) location destructor ~ret
~actuals:[(deleted_access, typ)] ~formals_opt:None ~call_kind:`ResolvedProcname astate
~actuals:[(deleted_access, typ)]
~formals_opt:None ~call_kind:`ResolvedProcname astate
|> fst )
| _ ->
L.d_printfln "Object being deleted is not a pointer to a class, got '%a' instead@\n"
Expand Down
3 changes: 1 addition & 2 deletions infer/src/pulse/PulseNonDisjunctiveOperations.ml
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ let mark_modified_address_at ~address ~source_addr_opt ?(is_source = false) ~cop
NonDisjDomain.mark_copy_as_modified ~copied_into ~source_addr_opt astate_n
~is_modified:(fun copy_heap ->
let reachable_addresses_from_copy =
BaseDomain.reachable_addresses_from
(Caml.List.to_seq [address])
BaseDomain.reachable_addresses_from (Caml.List.to_seq [address])
(astate.AbductiveDomain.post :> BaseDomain.t)
in
let current_heap = (astate.AbductiveDomain.post :> BaseDomain.t).heap in
Expand Down
2 changes: 1 addition & 1 deletion infer/src/pulse/PulseObjectiveCSummary.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ let init_fields_zero tenv path location ~zero addr typ astate =
match get_fields typ with
| Some fields ->
List.fold fields ~init:(Ok astate) ~f:(fun acc (field, field_typ, _) ->
let* acc = acc in
let* acc in
let acc, field_addr = Memory.eval_edge addr (FieldAccess field) acc in
init_fields_zero_helper field_addr field_typ acc )
| None ->
Expand Down
2 changes: 1 addition & 1 deletion opam/ocamlformat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ocamlformat.0.19.0-24-g2596a5c7 -k git https://github.com/danielmercier/ocamlformat.git#master
ocamlformat.0.22.4-3-g839cc56 -k git https://github.com/ocaml-ppx/ocamlformat.git#nebuchadnezzar
1 change: 1 addition & 0 deletions sledge/.ocamlformat
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ocaml-version = 4.14
profile = ocamlformat
break-cases = fit
break-infix = fit-or-vertical
Expand Down
6 changes: 2 additions & 4 deletions sledge/cli/frontend.ml
Original file line number Diff line number Diff line change
Expand Up @@ -961,8 +961,7 @@ let xlate_jump :
let src_lbl = label_of_block (Llvm.instr_parent instr) in
let lbl = src_lbl ^ ".jmp." ^ dst_lbl in
let blk =
Block.mk ~lbl
~cmnd:(IArray.of_array [|mov|])
Block.mk ~lbl ~cmnd:(IArray.of_array [|mov|])
~term:(Term.goto ~dst:jmp ~loc)
in
let blocks =
Expand Down Expand Up @@ -1425,8 +1424,7 @@ let xlate_instr :
in
let lbl_i = lbl ^ "." ^ Int.to_string i in
let blk =
Block.mk ~lbl:lbl_i
~cmnd:(IArray.of_array [|mov|])
Block.mk ~lbl:lbl_i ~cmnd:(IArray.of_array [|mov|])
~term:(Term.goto ~dst:(Jump.mk lbl) ~loc)
in
(Jump.mk lbl_i, blk :: rev_blocks)
Expand Down
2 changes: 1 addition & 1 deletion sledge/src/domain_sh.ml
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ let retn tid formals freturn {areturn; unshadow; frame} q =
type term_code = Term.t option [@@deriving compare, sexp_of]

let term tid formals freturn q =
let* freturn = freturn in
let* freturn in
let formals =
Var.Set.of_iter (Iter.map ~f:(X.reg tid) (IArray.to_iter formals))
in
Expand Down
2 changes: 1 addition & 1 deletion sledge/src/fol/arithmetic.ml
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ struct
match get_mono for_poly with
| Some m ->
let c, p = Sum.find_and_remove m a in
let* c = c in
let* c in
solve_for_mono Sum.empty c m p
| _ -> None )
end
Expand Down
Loading

0 comments on commit df7b7d2

Please sign in to comment.