fix(tvix/eval): calling a catchable is catchable

When attempting to call a Value, if it is a Value::Catchable we must
not cause an uncatchable failure.  This commit simply reuses the
Value::Catchable as the result of attempting to call it.  This is
safe because nix is designed so that nix code cannot distinguish
between different catchable failures -- they all look the same to
the interpreted code.

This fixes b/351.

Change-Id: Ibf763a08753e541843626182ff59fdbf15ea2959
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10300
Autosubmit: Adam Joseph <adam@westernsemico.com>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
Adam Joseph 2023-12-12 01:52:39 -08:00 committed by clbot
parent 52b68c0539
commit 2949ee08f1
3 changed files with 8 additions and 0 deletions

View file

@ -0,0 +1 @@
(builtins.tryEval (throw "fred" 5)).success

View file

@ -1056,6 +1056,12 @@ impl<'o> VM<'o> {
self.enqueue_generator("__functor call", span, |co| call_functor(co, val)); self.enqueue_generator("__functor call", span, |co| call_functor(co, val));
Ok(()) Ok(())
} }
val @ Value::Catchable(_) => {
self.stack.push(val);
Ok(())
}
v => Err(ErrorKind::NotCallable(v.type_of())).with_span(&span, self), v => Err(ErrorKind::NotCallable(v.type_of())).with_span(&span, self),
} }
} }