From 3603fbf9d321602a2df51e7b3f7a69425bd4d304 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 27 Dec 2019 15:12:26 +0000 Subject: Revert "Implement PartialEq manually for ValueKind" This reverts commit 88c31554561bd7a600560af0e6bc97c48649f43f. --- dhall/src/semantics/core/value.rs | 65 +-------------------------------------- 1 file changed, 1 insertion(+), 64 deletions(-) diff --git a/dhall/src/semantics/core/value.rs b/dhall/src/semantics/core/value.rs index 37f95ca..f06c614 100644 --- a/dhall/src/semantics/core/value.rs +++ b/dhall/src/semantics/core/value.rs @@ -51,7 +51,7 @@ pub(crate) enum Form { NF, } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq)] pub(crate) enum ValueKind { /// Closures Lam(AlphaLabel, Value, Value), @@ -570,69 +570,6 @@ impl std::cmp::PartialEq for Value { } impl std::cmp::Eq for Value {} -impl std::cmp::PartialEq for ValueKind { - fn eq(&self, other: &Self) -> bool { - use ValueKind::*; - match (self, other) { - (Lam(x0, x1, x2), Lam(y0, y1, y2)) => { - x0 == y0 && x1 == y1 && x2 == y2 - } - (Pi(x0, x1, x2), Pi(y0, y1, y2)) => { - x0 == y0 && x1 == y1 && x2 == y2 - } - (AppliedBuiltin(x0, x1), AppliedBuiltin(y0, y1)) => { - x0 == y0 && x1 == y1 - } - (Var(x0), Var(y0)) => x0 == y0, - (Const(x0), Const(y0)) => x0 == y0, - (BoolLit(x0), BoolLit(y0)) => x0 == y0, - (NaturalLit(x0), NaturalLit(y0)) => x0 == y0, - (IntegerLit(x0), IntegerLit(y0)) => x0 == y0, - (DoubleLit(x0), DoubleLit(y0)) => x0 == y0, - (EmptyOptionalLit(x0), EmptyOptionalLit(y0)) => x0 == y0, - (NEOptionalLit(x0), NEOptionalLit(y0)) => x0 == y0, - (EmptyListLit(x0), EmptyListLit(y0)) => x0 == y0, - (NEListLit(x0), NEListLit(y0)) => x0 == y0, - (RecordType(x0), RecordType(y0)) => x0 == y0, - (RecordLit(x0), RecordLit(y0)) => x0 == y0, - (UnionType(x0), UnionType(y0)) => x0 == y0, - (UnionConstructor(x0, x1), UnionConstructor(y0, y1)) => { - x0 == y0 && x1 == y1 - } - (UnionLit(x0, x1, x2), UnionLit(y0, y1, y2)) => { - x0 == y0 && x1 == y1 && x2 == y2 - } - (TextLit(x0), TextLit(y0)) => x0 == y0, - (Equivalence(x0, x1), Equivalence(y0, y1)) => x0 == y0 && x1 == y1, - (PartialExpr(x0), PartialExpr(y0)) => x0 == y0, - - // Explicitely list all constructors to ensure we don't forget to update this function. - (Lam(..), _) - | (Pi(..), _) - | (AppliedBuiltin(..), _) - | (Var(..), _) - | (Const(..), _) - | (BoolLit(..), _) - | (NaturalLit(..), _) - | (IntegerLit(..), _) - | (DoubleLit(..), _) - | (EmptyOptionalLit(..), _) - | (NEOptionalLit(..), _) - | (EmptyListLit(..), _) - | (NEListLit(..), _) - | (RecordType(..), _) - | (RecordLit(..), _) - | (UnionType(..), _) - | (UnionConstructor(..), _) - | (UnionLit(..), _) - | (TextLit(..), _) - | (Equivalence(..), _) - | (PartialExpr(..), _) => false, - } - } -} -impl std::cmp::Eq for ValueKind {} - impl std::fmt::Debug for Value { fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let vint: &ValueInternal = &self.as_internal(); -- cgit v1.2.3