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;