diff options
author | Nadrieril | 2020-01-30 19:56:31 +0000 |
---|---|---|
committer | Nadrieril | 2020-01-30 19:56:31 +0000 |
commit | d8de45763037937b5c2dedbe5f7bb95a4e7bc7cd (patch) | |
tree | 0c73b8ec2df6e8f592136133f07957e3ae8e8931 /dhall/src/semantics/tck | |
parent | 673a580e11d31356bec25d73213b283685fd6ea3 (diff) |
Avoid unnecessary allocations of `Value`s
Diffstat (limited to 'dhall/src/semantics/tck')
-rw-r--r-- | dhall/src/semantics/tck/env.rs | 2 | ||||
-rw-r--r-- | dhall/src/semantics/tck/tyexpr.rs | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/dhall/src/semantics/tck/env.rs b/dhall/src/semantics/tck/env.rs index d4cc37d..812ca7a 100644 --- a/dhall/src/semantics/tck/env.rs +++ b/dhall/src/semantics/tck/env.rs @@ -118,7 +118,7 @@ impl TyEnv { } pub fn lookup(&self, var: &V) -> Option<(TyExprKind, Type)> { let var = self.names.unlabel_var(var)?; - let ty = self.items.lookup_val(&var).get_type().unwrap(); + let ty = self.items.lookup_ty(&var); Some((TyExprKind::Var(var), ty)) } } diff --git a/dhall/src/semantics/tck/tyexpr.rs b/dhall/src/semantics/tck/tyexpr.rs index 4b88048..1a048f9 100644 --- a/dhall/src/semantics/tck/tyexpr.rs +++ b/dhall/src/semantics/tck/tyexpr.rs @@ -1,5 +1,4 @@ use crate::error::{TypeError, TypeMessage}; -use crate::semantics::normalize_tyexpr_whnf; use crate::semantics::{rc, NameEnv, NzEnv, TyEnv, Value}; use crate::syntax::{ExprKind, Span, V}; use crate::Normalized; @@ -83,7 +82,9 @@ impl TyExpr { } /// Eval a closed TyExpr fully and recursively; pub fn rec_eval_closed_expr(&self) -> Value { - normalize_tyexpr_whnf(self, &NzEnv::new()) + let mut val = self.eval_closed_expr(); + val.normalize_mut(); + val } } |