summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/tck/tyexpr.rs
diff options
context:
space:
mode:
authorNadrieril2020-02-14 18:55:27 +0000
committerNadrieril2020-02-14 18:55:27 +0000
commit51cf6a28fa56031dbeae0ff378f0ef84eff7fd3e (patch)
treeff452de7a7b4c15b18b1aa43b05a5afafdd5ef58 /dhall/src/semantics/tck/tyexpr.rs
parent350d1cf7d9c114b1334b2743071b0b99ea64c1ec (diff)
Oops
Diffstat (limited to '')
-rw-r--r--dhall/src/semantics/tck/tyexpr.rs12
1 files changed, 5 insertions, 7 deletions
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<TyExpr, TypeError> {
+ 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<Const> {
- self.get_type_tyexpr(env).ty().as_const()
+ pub fn get_kind(&self, env: &TyEnv) -> Result<Option<Const>, TypeError> {
+ Ok(self.get_type_tyexpr(env)?.ty().as_const())
}
pub fn to_hir(&self) -> Hir {