From 70dbe8db74f012de340e887c7ad653f108bbf975 Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Wed, 3 Feb 2016 19:54:53 -0800 Subject: [PATCH] Simplify the type comparison of Java classes Reviewed By: cristianoc Differential Revision: D2876204 fb-gh-sync-id: d6a1849 --- infer/src/backend/sil.ml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/infer/src/backend/sil.ml b/infer/src/backend/sil.ml index 6419bcdcf..dadc23f07 100644 --- a/infer/src/backend/sil.ml +++ b/infer/src/backend/sil.ml @@ -1298,11 +1298,14 @@ let rec const_compare (c1 : const) (c2 : const) : int = | Ctuple el1, Ctuple el2 -> IList.compare exp_compare el1 el2 and struct_typ_compare struct_typ1 struct_typ2 = - let n = fld_typ_ann_list_compare struct_typ1.instance_fields struct_typ2.instance_fields in - if n <> 0 then n else - let n = fld_typ_ann_list_compare struct_typ1.static_fields struct_typ2.static_fields in - if n <> 0 then n else let n = Csu.compare struct_typ1.csu struct_typ2.csu in - if n <> 0 then n else cname_opt_compare struct_typ1.struct_name struct_typ2.struct_name + if struct_typ1.csu = Csu.Class Csu.Java && struct_typ2.csu = Csu.Class Csu.Java then + cname_opt_compare struct_typ1.struct_name struct_typ2.struct_name + else + let n = fld_typ_ann_list_compare struct_typ1.instance_fields struct_typ2.instance_fields in + if n <> 0 then n else + let n = fld_typ_ann_list_compare struct_typ1.static_fields struct_typ2.static_fields in + if n <> 0 then n else let n = Csu.compare struct_typ1.csu struct_typ2.csu in + if n <> 0 then n else cname_opt_compare struct_typ1.struct_name struct_typ2.struct_name (** Comparision for types. *) and typ_compare t1 t2 =