From d8ecfbfc4babb9add00be03ee3a2251355388f3a Mon Sep 17 00:00:00 2001 From: Mehdi Bouaziz Date: Wed, 17 Oct 2018 06:57:54 -0700 Subject: [PATCH] Do not compare types of array elements in access paths and access expressions Reviewed By: jvillard Differential Revision: D10414107 fbshipit-source-id: 7c51e1726 --- infer/src/IR/AccessExpression.ml | 6 +++++- infer/src/IR/AccessPath.ml | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/infer/src/IR/AccessExpression.ml b/infer/src/IR/AccessExpression.ml index c5c0e06fc..1516b8763 100644 --- a/infer/src/IR/AccessExpression.ml +++ b/infer/src/IR/AccessExpression.ml @@ -8,10 +8,14 @@ open! IStd module F = Format +type typ_ = Typ.t + +let compare_typ_ _ _ = 0 + type t = | Base of AccessPath.base | FieldOffset of t * Typ.Fieldname.t - | ArrayOffset of t * Typ.t * t list + | ArrayOffset of t * typ_ * t list | AddressOf of t | Dereference of t [@@deriving compare] diff --git a/infer/src/IR/AccessPath.ml b/infer/src/IR/AccessPath.ml index 1a43b66b2..3b6af7622 100644 --- a/infer/src/IR/AccessPath.ml +++ b/infer/src/IR/AccessPath.ml @@ -19,13 +19,13 @@ module Raw = struct let equal_base = [%compare.equal: base] - type access = ArrayAccess of Typ.t * t list | FieldAccess of Typ.Fieldname.t + type access = ArrayAccess of typ_ * t list | FieldAccess of Typ.Fieldname.t and t = base * access list [@@deriving compare] let equal_access = [%compare.equal: access] - let equal_access_list l1 l2 = Int.equal (List.compare compare_access l1 l2) 0 + let equal_access_list = [%compare.equal: access list] let may_pp_typ fmt typ = if Config.debug_level_analysis >= 3 then F.fprintf fmt ":%a" (Typ.pp Pp.text) typ