summaryrefslogtreecommitdiff
path: root/dhall
diff options
context:
space:
mode:
Diffstat (limited to 'dhall')
-rw-r--r--dhall/src/core/context.rs11
1 files changed, 10 insertions, 1 deletions
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<T> Context<T> {
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::<Result<_, _>>()?,
+ )))
+ }
}
fn subst_shift(&self, var: &AlphaVar, val: &Typed) -> Self
where