From 122d2b031f6d405dd4357e833d2cd3a8a2d62149 Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Tue, 29 Nov 2016 16:35:25 -0800 Subject: [PATCH] ppx_compare Unop Reviewed By: sblackshear Differential Revision: D4232382 fbshipit-source-id: 292121c --- infer/src/IR/Unop.re | 14 ++------------ infer/src/IR/Unop.rei | 5 ++--- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/infer/src/IR/Unop.re b/infer/src/IR/Unop.re index 4890810fd..4671e4b0f 100644 --- a/infer/src/IR/Unop.re +++ b/infer/src/IR/Unop.re @@ -23,18 +23,8 @@ let module F = Format; type t = | Neg /** Unary minus */ | BNot /** Bitwise complement (~) */ - | LNot /** Logical Not (!) */; - -let compare o1 o2 => - switch (o1, o2) { - | (Neg, Neg) => 0 - | (Neg, _) => (-1) - | (_, Neg) => 1 - | (BNot, BNot) => 0 - | (BNot, _) => (-1) - | (_, BNot) => 1 - | (LNot, LNot) => 0 - }; + | LNot /** Logical Not (!) */ +[@@deriving compare]; let equal o1 o2 => compare o1 o2 == 0; diff --git a/infer/src/IR/Unop.rei b/infer/src/IR/Unop.rei index a0620bf02..3797d43ce 100644 --- a/infer/src/IR/Unop.rei +++ b/infer/src/IR/Unop.rei @@ -23,12 +23,11 @@ let module F = Format; type t = | Neg /** Unary minus */ | BNot /** Bitwise complement (~) */ - | LNot /** Logical Not (!) */; + | LNot /** Logical Not (!) */ +[@@deriving compare]; let equal: t => t => bool; -let compare: t => t => int; - /** String representation of a unary operator. */ let str: t => string;