From 2f1fa26abd9c9f2b75d24b18877d3b278f7d2a01 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 23 Apr 2019 14:13:50 +0200 Subject: Avoid duplicating work when matching on Pi types --- dhall/src/expr.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'dhall/src/expr.rs') diff --git a/dhall/src/expr.rs b/dhall/src/expr.rs index 94093a9..1c3ec53 100644 --- a/dhall/src/expr.rs +++ b/dhall/src/expr.rs @@ -139,6 +139,7 @@ impl<'a> Type<'a> { // use TypeInternal::*; // Type(match self.0 { // Expr(e) => Expr(Box::new(e.unnote())), + // Pi(ctx, c, x, t, e) => Pi(ctx, c, x, t, e), // Const(c) => Const(c), // SuperType => SuperType, // }) @@ -150,6 +151,14 @@ impl<'a> Type<'a> { impl<'a> SimpleType<'a> { pub(crate) fn into_type(self) -> Type<'a> { - Normalized(self.0, Some(Type::const_type()), PhantomData).into_type() + self.into_type_ctx(&crate::typecheck::TypecheckContext::new()) + } + pub(crate) fn into_type_ctx( + self, + ctx: &crate::typecheck::TypecheckContext, + ) -> Type<'a> { + Normalized(self.0, Some(Type::const_type()), PhantomData) + .into_type_ctx(ctx) + .unwrap() } } -- cgit v1.2.3