summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/tck/typecheck.rs
diff options
context:
space:
mode:
authorNadrieril2020-02-13 19:48:11 +0000
committerNadrieril2020-02-13 19:48:11 +0000
commit7b649b8647c60f1c02050805520f307edff0a94f (patch)
tree73a6a38e430ba257228fd04ee69fc4f5e138ad7f /dhall/src/semantics/tck/typecheck.rs
parent40bee3cdcb9ac0c76996feeceb6ca160a6bd8b42 (diff)
Only store type at root node in tyexpr
Diffstat (limited to 'dhall/src/semantics/tck/typecheck.rs')
-rw-r--r--dhall/src/semantics/tck/typecheck.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/dhall/src/semantics/tck/typecheck.rs b/dhall/src/semantics/tck/typecheck.rs
index c52cfda..c854552 100644
--- a/dhall/src/semantics/tck/typecheck.rs
+++ b/dhall/src/semantics/tck/typecheck.rs
@@ -6,7 +6,7 @@ use crate::error::{ErrorBuilder, TypeError, TypeMessage};
use crate::semantics::merge_maps;
use crate::semantics::{
type_of_builtin, Binder, BuiltinClosure, Closure, Hir, HirKind, TyEnv,
- TyExpr, TyExprKind, Type, Value, ValueKind,
+ TyExpr, Type, Value, ValueKind,
};
use crate::syntax::{
BinOp, Builtin, Const, ExprKind, InterpolatedTextContents, LitKind, Span,
@@ -758,18 +758,22 @@ fn type_one_layer(
}
};
- Ok(TyExpr::new(TyExprKind::Expr(ekind), Some(ty), span))
+ Ok(TyExpr::new(
+ HirKind::Expr(ekind.map_ref(|tye| tye.to_hir())),
+ Some(ty),
+ span,
+ ))
}
/// `type_with` typechecks an expressio in the provided environment.
pub(crate) fn type_with(env: &TyEnv, hir: &Hir) -> Result<TyExpr, TypeError> {
let (tyekind, ty) = match hir.kind() {
- HirKind::Var(var) => (TyExprKind::Var(*var), Some(env.lookup(var))),
+ HirKind::Var(var) => (HirKind::Var(*var), Some(env.lookup(var))),
HirKind::Expr(ExprKind::Var(_)) => {
unreachable!("Hir should contain no unresolved variables")
}
HirKind::Expr(ExprKind::Const(Const::Sort)) => {
- (TyExprKind::Expr(ExprKind::Const(Const::Sort)), None)
+ (HirKind::Expr(ExprKind::Const(Const::Sort)), None)
}
HirKind::Expr(ekind) => {
let ekind = match ekind {