From 51cf6a28fa56031dbeae0ff378f0ef84eff7fd3e Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 14 Feb 2020 18:55:27 +0000 Subject: Oops --- dhall/src/semantics/tck/tyexpr.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'dhall/src/semantics/tck/tyexpr.rs') diff --git a/dhall/src/semantics/tck/tyexpr.rs b/dhall/src/semantics/tck/tyexpr.rs index ac15ac5..c7b8009 100644 --- a/dhall/src/semantics/tck/tyexpr.rs +++ b/dhall/src/semantics/tck/tyexpr.rs @@ -1,3 +1,4 @@ +use crate::error::TypeError; use crate::semantics::{Hir, HirKind, NzEnv, TyEnv, Value}; use crate::syntax::{Const, Span}; use crate::{NormalizedExpr, ToExprOptions}; @@ -25,16 +26,13 @@ impl TyExpr { pub fn ty(&self) -> &Type { &self.ty } - pub fn get_type_tyexpr(&self, env: &TyEnv) -> TyExpr { - self.ty() - .to_hir(env.as_varenv()) - .typecheck(env) - .expect("Internal type error") + pub fn get_type_tyexpr(&self, env: &TyEnv) -> Result { + Ok(self.ty().to_hir(env.as_varenv()).typecheck(env)?) } /// Get the kind (the type of the type) of this value // TODO: avoid recomputing so much - pub fn get_kind(&self, env: &TyEnv) -> Option { - self.get_type_tyexpr(env).ty().as_const() + pub fn get_kind(&self, env: &TyEnv) -> Result, TypeError> { + Ok(self.get_type_tyexpr(env)?.ty().as_const()) } pub fn to_hir(&self) -> Hir { -- cgit v1.2.3