From 439947345ef52ce04a66b1d4fa9c05d2b6964fa1 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 29 Apr 2019 21:52:47 +0200 Subject: Don't shift by mutable ref --- dhall_core/src/core.rs | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'dhall_core') diff --git a/dhall_core/src/core.rs b/dhall_core/src/core.rs index a20f6d1..54d7cee 100644 --- a/dhall_core/src/core.rs +++ b/dhall_core/src/core.rs @@ -434,6 +434,24 @@ impl SubExpr { rc(self.as_ref().visit(&mut visitor::UnNoteVisitor)) } + /// `shift` is used by both normalization and type-checking to avoid variable + /// capture by shifting variable indices + /// See https://github.com/dhall-lang/dhall-lang/blob/master/standard/semantics.md#shift + /// for details + pub fn shift(&self, delta: isize, var: &V