diff --git a/infer/src/IR/AccessPath.mli b/infer/src/IR/AccessPath.mli index c5b6def91..3b0bd76b3 100644 --- a/infer/src/IR/AccessPath.mli +++ b/infer/src/IR/AccessPath.mli @@ -14,7 +14,7 @@ type base = Var.t * Typ.t [@@deriving compare] type access = | ArrayAccess of Typ.t * t list (** array element type with list of access paths in index *) | FieldAccess of Fieldname.t (** field name *) -[@@deriving compare] +[@@deriving compare, equal] (** root var, and a list of accesses. closest to the root var is first that is, x.f.g is representedas (x, [f; g]) *) diff --git a/infer/src/concurrency/starvationDomain.ml b/infer/src/concurrency/starvationDomain.ml index 5d796a620..832ade9a2 100644 --- a/infer/src/concurrency/starvationDomain.ml +++ b/infer/src/concurrency/starvationDomain.ml @@ -83,20 +83,26 @@ module ThreadDomain = struct end module Lock = struct - type var = Var.t + (** var type used only for printing, not comparisons *) + module IgnoreVar = struct + type t = Var.t - let compare_var = Var.compare_modulo_this + let compare _x _y = 0 - type path = (var * Typ.t) * AccessPath.access list [@@deriving compare] + let equal _x _y = true + end + + (** access path that does not ignore the type (like the original AccessPath.t) but which instead + ignores the root variable for comparisons; this is taken care of by the root type *) + type path = (IgnoreVar.t * Typ.t) * AccessPath.access list [@@deriving compare, equal] type root = | Global of Mangled.t | Class of Typ.name | Parameter of int (** method parameter represented by its 0-indexed position *) + [@@deriving compare, equal] - type t = {root: root [@compare.ignore]; path: path} [@@deriving compare] - - let equal = [%compare.equal: t] + type t = {root: root; path: path} [@@deriving compare, equal] (* using an indentifier for a class object, create an access path representing that lock; this is for synchronizing on Java class objects only *)