From ba19f41873fec98bb24ba709f4b76c3f58ca5aaa Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 15 Aug 2019 13:05:23 +0200 Subject: Fix bug in shifting contexts --- dhall/src/core/context.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dhall/src/core/context.rs b/dhall/src/core/context.rs index 62affcf..8d14415 100644 --- a/dhall/src/core/context.rs +++ b/dhall/src/core/context.rs @@ -97,7 +97,16 @@ impl Context { where T: Clone + Shift, { - Some(self.do_with_var(var, |var, i| Ok(i.shift(delta, &var)?))?) + if delta < 0 { + Some(self.do_with_var(var, |var, i| Ok(i.shift(delta, &var)?))?) + } else { + Some(Context(Rc::new( + self.0 + .iter() + .map(|(l, i)| Ok((l.clone(), i.shift(delta, &var)?))) + .collect::>()?, + ))) + } } fn subst_shift(&self, var: &AlphaVar, val: &Typed) -> Self where -- cgit v1.2.3