[inferbo] Ignore type on field comparison

Summary: This diff ignores field's type in their comparisons.  They should be distinguished by their names and struct types.

Reviewed By: dulmarod

Differential Revision: D17284621

fbshipit-source-id: ae8a33083
master
Sungkeun Cho 5 years ago committed by Facebook Github Bot
parent afcb0ab46b
commit c20bda0350

@ -127,12 +127,16 @@ module Allocsite = struct
end end
module Loc = struct module Loc = struct
type field_typ = Typ.t option
let compare_field_typ _ _ = 0
include (* Enforce invariants on Field and StarField, see Symb.mli *) ( include (* Enforce invariants on Field and StarField, see Symb.mli *) (
struct struct
type t = type t =
| Var of Var.t | Var of Var.t
| Allocsite of Allocsite.t | Allocsite of Allocsite.t
| Field of {prefix: t; fn: Typ.Fieldname.t; typ: Typ.t option} | Field of {prefix: t; fn: Typ.Fieldname.t; typ: field_typ}
| StarField of {prefix: t; last_field: Typ.Fieldname.t} | StarField of {prefix: t; last_field: Typ.Fieldname.t}
[@@deriving compare] [@@deriving compare]
@ -173,7 +177,7 @@ module Loc = struct
type t = private type t = private
| Var of Var.t | Var of Var.t
| Allocsite of Allocsite.t | Allocsite of Allocsite.t
| Field of {prefix: t; fn: Typ.Fieldname.t; typ: Typ.t option} | Field of {prefix: t; fn: Typ.Fieldname.t; typ: field_typ}
| StarField of {prefix: t; last_field: Typ.Fieldname.t} | StarField of {prefix: t; last_field: Typ.Fieldname.t}
[@@deriving compare] [@@deriving compare]

@ -27,12 +27,16 @@ module SymbolPath = struct
let compare_deref_kind _ _ = 0 let compare_deref_kind _ _ = 0
type field_typ = Typ.t option
let compare_field_typ _ _ = 0
include (* Enforce invariants on Field and StarField *) ( include (* Enforce invariants on Field and StarField *) (
struct struct
type partial = type partial =
| Pvar of Pvar.t | Pvar of Pvar.t
| Deref of deref_kind * partial | Deref of deref_kind * partial
| Field of {fn: Typ.Fieldname.t; prefix: partial; typ: Typ.t option} | Field of {fn: Typ.Fieldname.t; prefix: partial; typ: field_typ}
| Callsite of {ret_typ: Typ.t; cs: CallSite.t} | Callsite of {ret_typ: Typ.t; cs: CallSite.t}
| StarField of {last_field: Typ.Fieldname.t; prefix: partial} | StarField of {last_field: Typ.Fieldname.t; prefix: partial}
[@@deriving compare] [@@deriving compare]
@ -76,7 +80,7 @@ module SymbolPath = struct
type partial = private type partial = private
| Pvar of Pvar.t | Pvar of Pvar.t
| Deref of deref_kind * partial | Deref of deref_kind * partial
| Field of {fn: Typ.Fieldname.t; prefix: partial; typ: Typ.t option} | Field of {fn: Typ.Fieldname.t; prefix: partial; typ: field_typ}
| Callsite of {ret_typ: Typ.t; cs: CallSite.t} | Callsite of {ret_typ: Typ.t; cs: CallSite.t}
| StarField of {last_field: Typ.Fieldname.t; prefix: partial} | StarField of {last_field: Typ.Fieldname.t; prefix: partial}
[@@deriving compare] [@@deriving compare]

Loading…
Cancel
Save