From 5107815c18d6f558bdd24dd35d18ef3396910184 Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Tue, 29 Nov 2016 16:32:09 -0800 Subject: [PATCH] ppx_compare Csu Reviewed By: cristianoc Differential Revision: D4232368 fbshipit-source-id: 12f1a15 --- infer/src/IR/Csu.re | 28 ++++------------------------ infer/src/IR/Csu.rei | 12 ++++++------ 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/infer/src/IR/Csu.re b/infer/src/IR/Csu.re index dcba9cdd2..d263756e8 100644 --- a/infer/src/IR/Csu.re +++ b/infer/src/IR/Csu.re @@ -15,13 +15,15 @@ open! Utils; type class_kind = | CPP | Java - | Objc; + | Objc +[@@deriving compare]; type t = | Class class_kind | Struct | Union - | Protocol; + | Protocol +[@@deriving compare]; let name = fun @@ -30,26 +32,4 @@ let name = | Union => "union" | Protocol => "protocol"; -let class_kind_num = - fun - | CPP => 1 - | Java => 2 - | Objc => 3; - -let class_kind_compare ck1 ck2 => class_kind_num ck1 - class_kind_num ck2; - -let compare dstruct1 dstruct2 => - switch (dstruct1, dstruct2) { - | (Class ck1, Class ck2) => class_kind_compare ck1 ck2 - | (Class _, _) => (-1) - | (_, Class _) => 1 - | (Struct, Struct) => 0 - | (Struct, _) => (-1) - | (_, Struct) => 1 - | (Union, Union) => 0 - | (Union, _) => (-1) - | (_, Union) => 1 - | (Protocol, Protocol) => 0 - }; - let equal tn1 tn2 => compare tn1 tn2 == 0; diff --git a/infer/src/IR/Csu.rei b/infer/src/IR/Csu.rei index 649777aea..208384cba 100644 --- a/infer/src/IR/Csu.rei +++ b/infer/src/IR/Csu.rei @@ -15,16 +15,16 @@ open! Utils; type class_kind = | CPP | Java - | Objc; + | Objc +[@@deriving compare]; type t = | Class class_kind | Struct | Union - | Protocol; - -let name: t => string; - -let compare: t => t => int; + | Protocol +[@@deriving compare]; let equal: t => t => bool; + +let name: t => string;