diff options
author | Nadrieril | 2020-02-15 19:05:26 +0000 |
---|---|---|
committer | Nadrieril | 2020-02-15 19:05:26 +0000 |
commit | d65d639ff93691adbf0a208edb99736003bc64bd (patch) | |
tree | 39a0a59fdb2deaa26f202d3141b2e6c779533377 /dhall/src/semantics/tck/tyexpr.rs | |
parent | 51cf6a28fa56031dbeae0ff378f0ef84eff7fd3e (diff) |
Factor some tck code to avoid needing get_type_tyexpr
Diffstat (limited to '')
-rw-r--r-- | dhall/src/semantics/tck/tyexpr.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/dhall/src/semantics/tck/tyexpr.rs b/dhall/src/semantics/tck/tyexpr.rs index c7b8009..dfb4397 100644 --- a/dhall/src/semantics/tck/tyexpr.rs +++ b/dhall/src/semantics/tck/tyexpr.rs @@ -26,13 +26,15 @@ impl TyExpr { pub fn ty(&self) -> &Type { &self.ty } - 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) -> Result<Option<Const>, TypeError> { - Ok(self.get_type_tyexpr(env)?.ty().as_const()) + Ok(self + .ty() + .to_hir(env.as_varenv()) + .typecheck(env)? + .ty() + .as_const()) } pub fn to_hir(&self) -> Hir { @@ -48,7 +50,7 @@ impl TyExpr { /// Eval the TyExpr. It will actually get evaluated only as needed on demand. pub fn eval(&self, env: impl Into<NzEnv>) -> Value { - self.as_hir().eval(&env.into()) + self.as_hir().eval(env.into()) } /// Eval a closed TyExpr (i.e. without free variables). It will actually get evaluated only as /// needed on demand. |