about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2022-10-25T09·35-0700
committerclbot <clbot@tvl.fyi>2022-11-05T22·03+0000
commit1cccf002bc7c86e97fa20031347485715d38c00d (patch)
tree875e4b404a63aa66042c92ea460892bd4b5a7789
parentc096152953d7178566f8ae53b63154b5f2bbb177 (diff)
fix(tvix/eval): Scope.inherit(): fix scope_depth, with_stack_depth r/5251
Scope_depth and with_stack_depth were being reset to zero for nested
function abstractions.  Fortunately nothing depends on them being
computed correctly in these cases, but it sure was confusing.

Change-Id: I59980b6a5aff043f60079f97211220b0086eb97d
Signed-off-by: Adam Joseph <adam@westernsemico.com>
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7091
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
-rw-r--r--tvix/eval/src/compiler/scope.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/tvix/eval/src/compiler/scope.rs b/tvix/eval/src/compiler/scope.rs
index 3b75bdbc42..d3c9f83007 100644
--- a/tvix/eval/src/compiler/scope.rs
+++ b/tvix/eval/src/compiler/scope.rs
@@ -171,6 +171,8 @@ impl Scope {
     pub fn inherit(&self) -> Self {
         Self {
             poisoned_tokens: self.poisoned_tokens.clone(),
+            scope_depth: self.scope_depth + 1,
+            with_stack_size: self.with_stack_size + 1,
             ..Default::default()
         }
     }