feat(tvix/eval): Implement builtins.tryEval
With asserts compiled using conditional jumps, this ends up being quite straightforward - the only real tricky bit is that we have to know whether an error can or can't be handled. Change-Id: I75617da73b7a9c5cdd888c0e26ae81d2c5c0d714 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6924 Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
This commit is contained in:
parent
0b8a967aca
commit
4fd18cbc9a
4 changed files with 32 additions and 0 deletions
1
tvix/eval/src/tests/tvix_tests/eval-okay-tryeval.exp
Normal file
1
tvix/eval/src/tests/tvix_tests/eval-okay-tryeval.exp
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ x = { success = true; value = "x"; }; y = { success = false; value = false; }; z = { success = false; value = false; }; }
|
||||
5
tvix/eval/src/tests/tvix_tests/eval-okay-tryeval.nix
Normal file
5
tvix/eval/src/tests/tvix_tests/eval-okay-tryeval.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
x = builtins.tryEval "x";
|
||||
y = builtins.tryEval (assert false; "y");
|
||||
z = builtins.tryEval (throw "bla");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue