From 61f8413a24fc9e215d948f6238584e493a66705f Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 30 Apr 2019 23:35:18 +0200 Subject: Remove now useless TypedOrType type --- dhall/src/typecheck.rs | 120 ++++++++++++++----------------------------------- 1 file changed, 34 insertions(+), 86 deletions(-) (limited to 'dhall') diff --git a/dhall/src/typecheck.rs b/dhall/src/typecheck.rs index fb698d0..cdc53a3 100644 --- a/dhall/src/typecheck.rs +++ b/dhall/src/typecheck.rs @@ -106,9 +106,6 @@ impl<'a> Type<'a> { pub(crate) fn normalize_whnf(&self) -> Result { Ok(self.0.normalize_whnf()?) } - pub(crate) fn as_typed(&self) -> Result, TypeError> { - self.0.as_typed() - } fn internal(&self) -> &TypeInternal<'a> { &self.0 } @@ -234,45 +231,6 @@ impl<'a> PartialEq for TypeInternal<'a> { } } -#[derive(Debug, Clone)] -pub(crate) enum TypedOrType { - Typed(Typed<'static>), - Type(Type<'static>), -} - -impl TypedOrType { - fn into_typed(self) -> Result, TypeError> { - match self { - TypedOrType::Typed(e) => Ok(e), - TypedOrType::Type(t) => Ok(t.into_normalized()?.into()), - } - } - fn normalize_to_type(&self) -> Type<'static> { - match self { - TypedOrType::Typed(e) => e.normalize_to_type(), - TypedOrType::Type(t) => t.clone(), - } - } - fn get_type(&self) -> Result>, TypeError> { - match self { - TypedOrType::Typed(e) => e.get_type(), - TypedOrType::Type(t) => t.get_type(), - } - } - fn get_type_move(self) -> Result, TypeError> { - match self { - TypedOrType::Typed(e) => Ok(e.get_type_move()?), - TypedOrType::Type(t) => Ok(t.get_type()?.into_owned()), - } - } - fn as_typed(&self) -> Result, TypeError> { - match self { - TypedOrType::Typed(e) => Ok(e.clone()), - TypedOrType::Type(t) => Ok(t.as_typed()?), - } - } -} - #[derive(Debug, Clone)] pub(crate) enum EnvItem { Type(V