diff --git a/infer/src/integration/Differential.ml b/infer/src/integration/Differential.ml index f45f61d05..888c2e8b8 100644 --- a/infer/src/integration/Differential.ml +++ b/infer/src/integration/Differential.ml @@ -57,9 +57,9 @@ let dedup (issues : Jsonbug_t.jsonbug list) = module CostsSummary = struct module DegreeMap = Caml.Map.Make (Int) - type 'a count = {top: 'a; zero: 'a; degrees: 'a DegreeMap.t} + type 'a count = {top: 'a; unreachable: 'a; zero: 'a; degrees: 'a DegreeMap.t} - let init = {top= 0; zero= 0; degrees= DegreeMap.empty} + let init = {top= 0; unreachable= 0; zero= 0; degrees= DegreeMap.empty} type previous_current = {previous: int; current: int} @@ -69,7 +69,8 @@ module CostsSummary = struct match CostDomain.BasicCost.degree e with | None -> if CostDomain.BasicCost.is_top e then {t with top= t.top + 1} - else if CostDomain.BasicCost.is_unreachable e then {t with zero= t.zero + 1} + else if CostDomain.BasicCost.is_unreachable e then + {t with unreachable= t.unreachable + 1; zero= t.zero + 1} else (* a cost with no degree must be either T/bottom*) assert false | Some d -> let degrees = DegreeMap.update (Polynomials.Degree.encode_to_int d) incr t.degrees in @@ -80,7 +81,7 @@ module CostsSummary = struct | None -> {t with top= t.top + 1} | Some d when Int.equal d 0 -> - {t with zero= t.zero + 1} + {t with unreachable= t.unreachable + 1; zero= t.zero + 1} | Some d -> let degrees = DegreeMap.update d incr t.degrees in {t with degrees} @@ -113,6 +114,7 @@ module CostsSummary = struct DegreeMap.merge merge_aux current previous in { top= {current= current_counts.top; previous= previous_counts.top} + ; unreachable= {current= current_counts.unreachable; previous= previous_counts.unreachable} ; zero= {current= current_counts.zero; previous= previous_counts.zero} ; degrees= compute_degrees current_counts.degrees previous_counts.degrees } @@ -131,6 +133,8 @@ module CostsSummary = struct in `Assoc [ ("top", create_assoc paired_counts.top.current paired_counts.top.previous) + ; ( "unreachable" + , create_assoc paired_counts.unreachable.current paired_counts.unreachable.previous ) ; ("zero", create_assoc paired_counts.zero.current paired_counts.zero.previous) ; ("degrees", `List json_degrees) ] end @@ -324,7 +328,7 @@ let of_costs ~(current_costs : Jsonbug_t.costs_report) ~(previous_costs : Jsonbu let curr_item = max_degree_polynomial current in let prev_item = max_degree_polynomial previous in if Config.filtering && (CostItem.is_one curr_item || CostItem.is_one prev_item) then - (* transitions to/from zero costs are obvious, no need to flag them *) + (* transitions to/from unreachable costs are obvious, no need to flag them *) (left, both, right) else let cmp = CostItem.compare_by_degree curr_item prev_item in diff --git a/infer/tests/build_systems/buck_flavors_diff/costs_summary.json.exp b/infer/tests/build_systems/buck_flavors_diff/costs_summary.json.exp index d04696a0c..21c96460c 100644 --- a/infer/tests/build_systems/buck_flavors_diff/costs_summary.json.exp +++ b/infer/tests/build_systems/buck_flavors_diff/costs_summary.json.exp @@ -1 +1 @@ -{"top":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[]} \ No newline at end of file +{"top":{"current":0,"previous":0},"unreachable":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[]} \ No newline at end of file diff --git a/infer/tests/build_systems/differential_interesting_paths_filter/costs_summary.json.exp b/infer/tests/build_systems/differential_interesting_paths_filter/costs_summary.json.exp index d04696a0c..21c96460c 100644 --- a/infer/tests/build_systems/differential_interesting_paths_filter/costs_summary.json.exp +++ b/infer/tests/build_systems/differential_interesting_paths_filter/costs_summary.json.exp @@ -1 +1 @@ -{"top":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[]} \ No newline at end of file +{"top":{"current":0,"previous":0},"unreachable":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[]} \ No newline at end of file diff --git a/infer/tests/build_systems/differential_of_costs_report/costs_summary.json.exp b/infer/tests/build_systems/differential_of_costs_report/costs_summary.json.exp index dbbaef29a..23f586549 100644 --- a/infer/tests/build_systems/differential_of_costs_report/costs_summary.json.exp +++ b/infer/tests/build_systems/differential_of_costs_report/costs_summary.json.exp @@ -1 +1 @@ -{"top":{"current":2,"previous":1},"zero":{"current":0,"previous":0},"degrees":[{"degree":0,"current":19,"previous":16},{"degree":100,"current":2,"previous":3},{"degree":101,"current":2,"previous":0},{"degree":200,"current":1,"previous":2}]} \ No newline at end of file +{"top":{"current":2,"previous":1},"unreachable":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[{"degree":0,"current":19,"previous":16},{"degree":100,"current":2,"previous":3},{"degree":101,"current":2,"previous":0},{"degree":200,"current":1,"previous":2}]} \ No newline at end of file diff --git a/infer/tests/build_systems/differential_skip_anonymous_class_renamings/costs_summary.json.exp b/infer/tests/build_systems/differential_skip_anonymous_class_renamings/costs_summary.json.exp index d04696a0c..21c96460c 100644 --- a/infer/tests/build_systems/differential_skip_anonymous_class_renamings/costs_summary.json.exp +++ b/infer/tests/build_systems/differential_skip_anonymous_class_renamings/costs_summary.json.exp @@ -1 +1 @@ -{"top":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[]} \ No newline at end of file +{"top":{"current":0,"previous":0},"unreachable":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[]} \ No newline at end of file diff --git a/infer/tests/build_systems/differential_skip_duplicated_types_on_filenames/costs_summary.json.exp b/infer/tests/build_systems/differential_skip_duplicated_types_on_filenames/costs_summary.json.exp index d04696a0c..21c96460c 100644 --- a/infer/tests/build_systems/differential_skip_duplicated_types_on_filenames/costs_summary.json.exp +++ b/infer/tests/build_systems/differential_skip_duplicated_types_on_filenames/costs_summary.json.exp @@ -1 +1 @@ -{"top":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[]} \ No newline at end of file +{"top":{"current":0,"previous":0},"unreachable":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[]} \ No newline at end of file diff --git a/infer/tests/build_systems/differential_skip_duplicated_types_on_filenames_with_renamings/costs_summary.json.exp b/infer/tests/build_systems/differential_skip_duplicated_types_on_filenames_with_renamings/costs_summary.json.exp index d04696a0c..21c96460c 100644 --- a/infer/tests/build_systems/differential_skip_duplicated_types_on_filenames_with_renamings/costs_summary.json.exp +++ b/infer/tests/build_systems/differential_skip_duplicated_types_on_filenames_with_renamings/costs_summary.json.exp @@ -1 +1 @@ -{"top":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[]} \ No newline at end of file +{"top":{"current":0,"previous":0},"unreachable":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[]} \ No newline at end of file diff --git a/infer/tests/build_systems/incremental_analysis_add_procedure/costs_summary.json.exp b/infer/tests/build_systems/incremental_analysis_add_procedure/costs_summary.json.exp index d04696a0c..21c96460c 100644 --- a/infer/tests/build_systems/incremental_analysis_add_procedure/costs_summary.json.exp +++ b/infer/tests/build_systems/incremental_analysis_add_procedure/costs_summary.json.exp @@ -1 +1 @@ -{"top":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[]} \ No newline at end of file +{"top":{"current":0,"previous":0},"unreachable":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[]} \ No newline at end of file diff --git a/infer/tests/build_systems/incremental_analysis_change_procedure/costs_summary.json.exp b/infer/tests/build_systems/incremental_analysis_change_procedure/costs_summary.json.exp index d04696a0c..21c96460c 100644 --- a/infer/tests/build_systems/incremental_analysis_change_procedure/costs_summary.json.exp +++ b/infer/tests/build_systems/incremental_analysis_change_procedure/costs_summary.json.exp @@ -1 +1 @@ -{"top":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[]} \ No newline at end of file +{"top":{"current":0,"previous":0},"unreachable":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[]} \ No newline at end of file diff --git a/infer/tests/build_systems/incremental_analysis_cost_change/costs_summary.json.exp b/infer/tests/build_systems/incremental_analysis_cost_change/costs_summary.json.exp index 7a1e48141..22dc4590c 100644 --- a/infer/tests/build_systems/incremental_analysis_cost_change/costs_summary.json.exp +++ b/infer/tests/build_systems/incremental_analysis_cost_change/costs_summary.json.exp @@ -1 +1 @@ -{"top":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[{"degree":0,"current":10,"previous":10},{"degree":100,"current":4,"previous":1},{"degree":200,"current":0,"previous":1}]} \ No newline at end of file +{"top":{"current":0,"previous":0},"unreachable":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[{"degree":0,"current":10,"previous":10},{"degree":100,"current":4,"previous":1},{"degree":200,"current":0,"previous":1}]} \ No newline at end of file diff --git a/infer/tests/build_systems/incremental_analysis_remove_file/costs_summary.json.exp b/infer/tests/build_systems/incremental_analysis_remove_file/costs_summary.json.exp index d04696a0c..21c96460c 100644 --- a/infer/tests/build_systems/incremental_analysis_remove_file/costs_summary.json.exp +++ b/infer/tests/build_systems/incremental_analysis_remove_file/costs_summary.json.exp @@ -1 +1 @@ -{"top":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[]} \ No newline at end of file +{"top":{"current":0,"previous":0},"unreachable":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[]} \ No newline at end of file