From 85d946016d67515aa70fa01338512e3fd7df408e Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 2 Nov 2020 04:06:05 +0000 Subject: Typecheck `with` using mutation --- dhall/src/semantics/tck/tir.rs | 3 +++ dhall/src/semantics/tck/typecheck.rs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'dhall/src/semantics/tck') diff --git a/dhall/src/semantics/tck/tir.rs b/dhall/src/semantics/tck/tir.rs index ec15a1f..f34802c 100644 --- a/dhall/src/semantics/tck/tir.rs +++ b/dhall/src/semantics/tck/tir.rs @@ -117,6 +117,9 @@ impl<'hir> Tir<'hir> { pub fn ty(&self) -> &Type { &self.ty } + pub fn into_ty(self) -> Type { + self.ty + } pub fn to_hir(&self) -> Hir { self.as_hir().clone() diff --git a/dhall/src/semantics/tck/typecheck.rs b/dhall/src/semantics/tck/typecheck.rs index d21c7ce..498bd76 100644 --- a/dhall/src/semantics/tck/typecheck.rs +++ b/dhall/src/semantics/tck/typecheck.rs @@ -35,7 +35,7 @@ fn type_one_layer( ) -> Result { let span_err = |msg: &str| mk_span_err(span.clone(), msg); - Ok(match &ekind { + Ok(match ekind { ExprKind::Import(..) => { unreachable!("This case should have been handled in resolution") } @@ -57,7 +57,7 @@ fn type_one_layer( NumKind::Double(_) => Builtin::Double, }), ExprKind::Builtin(b) => { - let t_hir = type_of_builtin(*b); + let t_hir = type_of_builtin(b); typecheck(&t_hir)?.eval_to_type(env)? } ExprKind::TextLit(interpolated) => { -- cgit v1.2.3