summaryrefslogtreecommitdiff
path: root/dhall/src
diff options
context:
space:
mode:
authorNadrieril2019-08-15 22:03:41 +0200
committerNadrieril2019-08-15 22:04:39 +0200
commit9e38d92bf481da8e34081c81c813acd802efa016 (patch)
treee274092f5d69284745e23afa122e11ce730074ac /dhall/src
parentb8234f63c27eb83ff54f719bf51bf3c969c36a3b (diff)
Fix variable substitution
I have no idea how this didn't get caught before
Diffstat (limited to 'dhall/src')
-rw-r--r--dhall/src/core/value.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/dhall/src/core/value.rs b/dhall/src/core/value.rs
index 036a20c..75ef5a5 100644
--- a/dhall/src/core/value.rs
+++ b/dhall/src/core/value.rs
@@ -436,10 +436,8 @@ impl Subst<Typed> for Value {
t.subst_shift(var, val),
e.subst_shift(&var.under_binder(x), &val.under_binder(x)),
),
- Value::Var(v) => match v.shift(-1, var) {
- None => val.to_value().clone(),
- Some(newvar) => Value::Var(newvar),
- },
+ Value::Var(v) if v == var => val.to_value(),
+ Value::Var(v) => Value::Var(v.shift(-1, var).unwrap()),
Value::Const(c) => Value::Const(*c),
Value::BoolLit(b) => Value::BoolLit(*b),
Value::NaturalLit(n) => Value::NaturalLit(*n),