summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNadrieril2019-04-25 14:25:03 +0200
committerNadrieril2019-04-25 14:25:03 +0200
commit03616cb0f86b166bc704e25a9e3da624d0a8c8df (patch)
tree5ed67f849008c5d9aafa1f9b359761ead38b1b72
parent1e499c4321e36938170a5b48d7f99fb8ee6cdc5b (diff)
Correctly shift values before inserting into context
Diffstat (limited to '')
-rw-r--r--dhall/src/typecheck.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/dhall/src/typecheck.rs b/dhall/src/typecheck.rs
index 7fcf28e..90809af 100644
--- a/dhall/src/typecheck.rs
+++ b/dhall/src/typecheck.rs
@@ -284,9 +284,10 @@ impl TypecheckContext {
}
pub(crate) fn insert_type(&self, x: &Label, t: Type<'static>) -> Self {
TypecheckContext(
- self.0
- .map(|_, e| e.shift0(1, x))
- .insert(x.clone(), EnvItem::Type(V(x.clone(), 0), t)),
+ self.0.map(|_, e| e.shift0(1, x)).insert(
+ x.clone(),
+ EnvItem::Type(V(x.clone(), 0), t.shift0(1, x)),
+ ),
)
}
pub(crate) fn insert_value(
@@ -294,7 +295,9 @@ impl TypecheckContext {
x: &Label,
t: Normalized<'static>,
) -> Self {
- TypecheckContext(self.0.insert(x.clone(), EnvItem::Value(t)))
+ TypecheckContext(
+ self.0.insert(x.clone(), EnvItem::Value(t.shift0(1, x))),
+ )
}
pub(crate) fn lookup(
&self,