From 03616cb0f86b166bc704e25a9e3da624d0a8c8df Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 25 Apr 2019 14:25:03 +0200 Subject: Correctly shift values before inserting into context --- dhall/src/typecheck.rs | 11 +++++++---- 1 file 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, -- cgit v1.2.3