From 27da7354277c7d069bdc1ca45b136ce0110cbe5b Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Tue, 29 Nov 2016 16:33:47 -0800 Subject: [PATCH] ppx_compare InferPrint Reviewed By: cristianoc Differential Revision: D4232375 fbshipit-source-id: efe3904 --- infer/src/backend/InferPrint.re | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/infer/src/backend/InferPrint.re b/infer/src/backend/InferPrint.re index dc2ce776d..2c9f80d7b 100644 --- a/infer/src/backend/InferPrint.re +++ b/infer/src/backend/InferPrint.re @@ -583,32 +583,12 @@ let pp_tests_of_report fmt report => { IList.iter pp_row report }; -let tests_jsonbug_compare bug1 bug2 => { - open Jsonbug_t; - let n = string_compare bug1.file bug2.file; - if (n != 0) { - n - } else { - let n = string_compare bug1.procedure bug2.procedure; - if (n != 0) { - n - } else { - let n = - int_compare - (bug1.line - bug1.procedure_start_line) (bug2.line - bug2.procedure_start_line); - if (n != 0) { - n - } else { - let n = string_compare bug1.bug_type bug2.bug_type; - if (n != 0) { - n - } else { - int_compare bug1.hash bug2.hash - } - } - } - } -}; +let tests_jsonbug_compare bug1 bug2 => + Jsonbug_t.( + [%compare : (string, string, int, string, int)] + (bug1.file, bug1.procedure, bug1.line - bug1.procedure_start_line, bug1.bug_type, bug1.hash) + (bug2.file, bug2.procedure, bug2.line - bug2.procedure_start_line, bug2.bug_type, bug2.hash) + ); let module IssuesTxt = {