From 7ba857a96eebbdd1cef0aa22407c870887d24aed Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 11 Apr 2019 19:11:33 +0200 Subject: Remove type parameter from TypeError --- dhall/src/typecheck.rs | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'dhall/src/typecheck.rs') diff --git a/dhall/src/typecheck.rs b/dhall/src/typecheck.rs index ab4142b..4881972 100644 --- a/dhall/src/typecheck.rs +++ b/dhall/src/typecheck.rs @@ -12,10 +12,10 @@ use dhall_generator as dhall; use self::TypeMessage::*; impl Resolved { - pub fn typecheck(self) -> Result> { + pub fn typecheck(self) -> Result { type_of(self.0.clone()) } - pub fn typecheck_with(self, ty: &Type) -> Result> { + pub fn typecheck_with(self, ty: &Type) -> Result { let expr: SubExpr<_, _> = self.0.clone(); let ty: SubExpr<_, _> = ty.as_normalized()?.as_expr().absurd(); type_of(dhall::subexpr!(expr: ty)) @@ -26,7 +26,7 @@ impl Resolved { } } impl Typed { - fn get_type_move(self) -> Result> { + fn get_type_move(self) -> Result { self.1.ok_or(TypeError::new( &Context::new(), self.0, @@ -45,7 +45,7 @@ impl Normalized { } } impl Type { - pub fn as_normalized(&self) -> Result<&Normalized, TypeError> { + pub fn as_normalized(&self) -> Result<&Normalized, TypeError> { use TypeInternal::*; match &self.0 { Expr(e) => Ok(e), @@ -56,7 +56,7 @@ impl Type { )), } } - pub(crate) fn into_normalized(self) -> Result> { + pub(crate) fn into_normalized(self) -> Result { use TypeInternal::*; match self.0 { Expr(e) => Ok(*e), @@ -68,7 +68,7 @@ impl Type { } } // Expose the outermost constructor - fn unroll_ref(&self) -> Result<&Expr, TypeError> { + fn unroll_ref(&self) -> Result<&Expr, TypeError> { Ok(self.as_normalized()?.unroll_ref()) } fn shift(&self, delta: isize, var: &V