diff --git a/infer/src/istd/IContainer.ml b/infer/src/istd/IContainer.ml index 63e0fb344..36675ab90 100644 --- a/infer/src/istd/IContainer.ml +++ b/infer/src/istd/IContainer.ml @@ -70,7 +70,7 @@ let filter ~fold ~filter t ~init ~f = let map ~f:g fold t ~init ~f = fold t ~init ~f:(fun acc item -> f acc (g item)) -let fold_of_pervasives_map_fold ~fold collection ~init ~f = +let fold_of_pervasives_map_fold fold collection ~init ~f = fold (fun item value accum -> f accum (item, value)) collection init diff --git a/infer/src/istd/IContainer.mli b/infer/src/istd/IContainer.mli index 325ca975f..2144afb47 100644 --- a/infer/src/istd/IContainer.mli +++ b/infer/src/istd/IContainer.mli @@ -46,7 +46,7 @@ val filter : val map : f:('a -> 'b) -> ('t, 'a, 'accum) Container.fold -> ('t, 'b, 'accum) Container.fold val fold_of_pervasives_map_fold : - fold:(('key -> 'value -> 'accum -> 'accum) -> 't -> 'accum -> 'accum) + (('key -> 'value -> 'accum -> 'accum) -> 't -> 'accum -> 'accum) -> ('t, 'key * 'value, 'accum) Container.fold val iter_result : diff --git a/infer/src/pulse/PulseBaseDomain.ml b/infer/src/pulse/PulseBaseDomain.ml index 3aeac7dc7..8092b085b 100644 --- a/infer/src/pulse/PulseBaseDomain.ml +++ b/infer/src/pulse/PulseBaseDomain.ml @@ -243,9 +243,8 @@ end = struct let fold ~var_filter astate ~init ~f ~finish = let finish (visited, accum) = (visited, finish accum) in let init = (AbstractValue.Set.empty, init) in - Container.fold_until astate.stack - ~fold:(IContainer.fold_of_pervasives_map_fold ~fold:Stack.fold) ~init ~finish - ~f:(fun visited_accum (var, (address, _loc)) -> + Container.fold_until astate.stack ~fold:(IContainer.fold_of_pervasives_map_fold Stack.fold) + ~init ~finish ~f:(fun visited_accum (var, (address, _loc)) -> if var_filter var then visit_address var ~f [] astate address visited_accum else Continue visited_accum ) end diff --git a/infer/src/pulse/PulseInterproc.ml b/infer/src/pulse/PulseInterproc.ml index 1af7cef10..b211dc2b7 100644 --- a/infer/src/pulse/PulseInterproc.ml +++ b/infer/src/pulse/PulseInterproc.ml @@ -76,7 +76,7 @@ let pp_contradiction fmt = function exception Contradiction of contradiction let fold_globals_of_stack call_loc stack call_state ~f = - Container.fold_result ~fold:(IContainer.fold_of_pervasives_map_fold ~fold:BaseStack.fold) + Container.fold_result ~fold:(IContainer.fold_of_pervasives_map_fold BaseStack.fold) stack ~init:call_state ~f:(fun call_state (var, stack_value) -> match var with | Var.ProgramVar pvar when Pvar.is_global pvar -> diff --git a/infer/src/pulse/PulseOperations.ml b/infer/src/pulse/PulseOperations.ml index 44f74ee25..f025e34e6 100644 --- a/infer/src/pulse/PulseOperations.ml +++ b/infer/src/pulse/PulseOperations.ml @@ -285,7 +285,7 @@ let check_address_escape escape_location proc_desc address history astate = in let check_address_of_stack_variable () = let proc_name = Procdesc.get_proc_name proc_desc in - IContainer.iter_result ~fold:(IContainer.fold_of_pervasives_map_fold ~fold:Stack.fold) astate + IContainer.iter_result ~fold:(IContainer.fold_of_pervasives_map_fold Stack.fold) astate ~f:(fun (variable, (var_address, _)) -> if AbstractValue.equal var_address address