diff options
author | Nadrieril | 2019-08-15 13:05:23 +0200 |
---|---|---|
committer | Nadrieril | 2019-08-15 13:05:23 +0200 |
commit | ba19f41873fec98bb24ba709f4b76c3f58ca5aaa (patch) | |
tree | abb991e6048172982036f6556c920f04bdad513b /dhall/src/core | |
parent | 67cdda53d95057174b86878f22dbc0efc0255fd9 (diff) |
Fix bug in shifting contexts
Diffstat (limited to 'dhall/src/core')
-rw-r--r-- | dhall/src/core/context.rs | 11 |
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 |