diff options
author | Nadrieril | 2019-04-23 14:13:50 +0200 |
---|---|---|
committer | Nadrieril | 2019-04-23 14:14:09 +0200 |
commit | 2f1fa26abd9c9f2b75d24b18877d3b278f7d2a01 (patch) | |
tree | 602fdc4982433680e82a0bfeb872140f09e828d0 /dhall/src/expr.rs | |
parent | 162d2a2a6d241d525346e295b0cf2ad43387bed5 (diff) |
Avoid duplicating work when matching on Pi types
Diffstat (limited to '')
-rw-r--r-- | dhall/src/expr.rs | 11 |
1 files changed, 10 insertions, 1 deletions
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() } } |