diff --git a/infer/src/integration/testDeterminator.ml b/infer/src/integration/testDeterminator.ml index c5d7f6828..9a050a74a 100644 --- a/infer/src/integration/testDeterminator.ml +++ b/infer/src/integration/testDeterminator.ml @@ -94,8 +94,8 @@ end [@@@warning "-32"] let pp_profiler_sample_set fmt s = - F.fprintf fmt " (set size = %i) " (JPS.ProfilerSample.cardinal s) ; - JPS.ProfilerSample.iter (fun m -> F.fprintf fmt "@\n %a " Typ.Procname.pp m) s + F.fprintf fmt " (set size = %i) " (Typ.Procname.Set.cardinal s) ; + Typ.Procname.Set.iter (fun m -> F.fprintf fmt "@\n %a " Typ.Procname.pp m) s module TestSample = struct @@ -126,16 +126,16 @@ let affected_methods method_range_map file_changed_lines changed_lines = if String.equal method_file file_changed_lines && List.exists ~f:(fun l -> in_range l range) changed_lines - then JPS.ProfilerSample.add key acc + then Typ.Procname.Set.add key acc else acc ) - method_range_map JPS.ProfilerSample.empty + method_range_map Typ.Procname.Set.empty let compute_affected_methods_java changed_lines_map method_range_map = - String.Map.fold changed_lines_map ~init:JPS.ProfilerSample.empty + String.Map.fold changed_lines_map ~init:Typ.Procname.Set.empty ~f:(fun ~key:file_changed_lines ~data acc -> let am = affected_methods method_range_map file_changed_lines data in - JPS.ProfilerSample.union am acc ) + Typ.Procname.Set.union am acc ) let compute_affected_methods_clang ~clang_range_map ~source_file ~changed_lines_map = @@ -144,13 +144,13 @@ let compute_affected_methods_clang ~clang_range_map ~source_file ~changed_lines_ | Some changed_lines -> affected_methods clang_range_map fname changed_lines | None -> - JPS.ProfilerSample.empty + Typ.Procname.Set.empty let emit_relevant_methods relevant_methods = let cleaned_methods = List.dedup_and_sort ~compare:String.compare - (List.map (JPS.ProfilerSample.elements relevant_methods) ~f:Typ.Procname.to_string) + (List.map (Typ.Procname.Set.elements relevant_methods) ~f:Typ.Procname.to_string) in let json = `List (List.map ~f:(fun t -> `String t) cleaned_methods) in let outpath = Config.results_dir ^/ Config.export_changed_functions_output in @@ -181,11 +181,11 @@ let test_to_run ?clang_range_map ?source_file () = compute_affected_methods_java changed_lines_map method_range in let profiler_samples = TestSample.read_test_sample test_samples_file in - if JPS.ProfilerSample.is_empty affected_methods then [] + if Typ.Procname.Set.is_empty affected_methods then [] else List.fold profiler_samples ~init:[] ~f:(fun acc (label, profiler_samples) -> - let intersection = JPS.ProfilerSample.inter affected_methods profiler_samples in - if JPS.ProfilerSample.is_empty intersection then acc else label :: acc ) + let intersection = Typ.Procname.Set.inter affected_methods profiler_samples in + if Typ.Procname.Set.is_empty intersection then acc else label :: acc ) let emit_tests_to_run relevant_tests = diff --git a/infer/src/java/JavaProfilerSamples.ml b/infer/src/java/JavaProfilerSamples.ml index ce8d3aa62..9411e8efd 100644 --- a/infer/src/java/JavaProfilerSamples.ml +++ b/infer/src/java/JavaProfilerSamples.ml @@ -7,7 +7,6 @@ open! IStd module L = Logging -module ProfilerSample = Caml.Set.Make (Typ.Procname) module JNI = struct (* https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/types.html *) @@ -282,13 +281,13 @@ let create_procname ~classname ~methodname ~signature = Typ.Procname.Java.Non_Static) -type labeled_profiler_sample = string * ProfilerSample.t [@@deriving compare] +type labeled_profiler_sample = string * Typ.Procname.Set.t [@@deriving compare] let equal_labeled_profiler_sample = [%compare.equal: labeled_profiler_sample] let from_java_profiler_samples j ~use_signature = let process_methods methods = - ProfilerSample.of_list + Typ.Procname.Set.of_list (List.map ~f:(fun {Java_profiler_samples_t.classname; methodname; signature} -> let signature = diff --git a/infer/src/java/JavaProfilerSamples.mli b/infer/src/java/JavaProfilerSamples.mli index a05bed2c5..9ab3a5d10 100644 --- a/infer/src/java/JavaProfilerSamples.mli +++ b/infer/src/java/JavaProfilerSamples.mli @@ -7,8 +7,6 @@ open! IStd -module ProfilerSample : Caml.Set.S with type elt = Typ.Procname.t - module JNI : sig val void_method_with_no_arguments : string @@ -41,7 +39,7 @@ module JNI : sig end end -type labeled_profiler_sample = string * ProfilerSample.t [@@deriving compare] +type labeled_profiler_sample = string * Typ.Procname.Set.t [@@deriving compare] val equal_labeled_profiler_sample : labeled_profiler_sample -> labeled_profiler_sample -> bool diff --git a/infer/src/unit/JavaProfilerSamplesTest.ml b/infer/src/unit/JavaProfilerSamplesTest.ml index 7b92cd878..22d81c7ca 100644 --- a/infer/src/unit/JavaProfilerSamplesTest.ml +++ b/infer/src/unit/JavaProfilerSamplesTest.ml @@ -163,7 +163,7 @@ let test_from_json_string_with_valid_input = 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 + let expected1 = [("label1", Typ.Procname.Set.of_list [])] in let input2 = Printf.sprintf "[{\"foo\":{},\"test\": \"label1\",\"methods\": [{\"class\": \"ggg.hhh.Iii\", \"boo\": \ @@ -178,7 +178,7 @@ let test_from_json_string_with_valid_input = in let expected2 = [ ( "label1" - , JavaProfilerSamples.ProfilerSample.of_list + , Typ.Procname.Set.of_list [ Typ.Procname.( Java (Java.make @@ -198,7 +198,7 @@ let test_from_json_string_with_valid_input = ; mk_split (None, "long") ] Java.Non_Static)) ] ) ; ( "label2" - , JavaProfilerSamples.ProfilerSample.of_list + , Typ.Procname.Set.of_list [ Typ.Procname.( Java (Java.make @@ -218,7 +218,7 @@ let test_from_json_string_with_valid_input = in let expected3 = [ ( "label1" - , JavaProfilerSamples.ProfilerSample.of_list + , Typ.Procname.Set.of_list [ Typ.Procname.( Java (Java.make @@ -230,7 +230,7 @@ let test_from_json_string_with_valid_input = (Typ.Name.Java.from_string "ggg.hhh.Iii") None "" [] Java.Non_Static)) ] ) ; ( "label2" - , JavaProfilerSamples.ProfilerSample.of_list + , Typ.Procname.Set.of_list [ Typ.Procname.( Java (Java.make