diff options
author | Vincent Ambo <mail@tazj.in> | 2023-03-03T07·54+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2023-03-13T20·30+0000 |
commit | eef48b8f1f3c7ae37a793bfef22c276dfd69767c (patch) | |
tree | 10eff587a994bcea2ca075638dd0ec5613fb088d /tvix/eval/src/tests/tvix_tests | |
parent | 43d04d9b985855cb431024d9895d52ea52fd4180 (diff) |
fix(tvix/eval): correctly thunk deferred formals access r/5970
Formals can be initialised with deferred default values (see the test cases), in which case they need an extra thunk to have something that can be finalised appropriately when the setup is done. Fixes: b/255 Change-Id: I380e3770be68eaa83ace96d450c7cead32dacc9f Reviewed-on: https://cl.tvl.fyi/c/depot/+/8196 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Diffstat (limited to 'tvix/eval/src/tests/tvix_tests')
-rw-r--r-- | tvix/eval/src/tests/tvix_tests/eval-okay-deferred-unary-formals.exp | 1 | ||||
-rw-r--r-- | tvix/eval/src/tests/tvix_tests/eval-okay-deferred-unary-formals.nix | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-deferred-unary-formals.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-deferred-unary-formals.exp new file mode 100644 index 000000000000..5993db7ccc5a --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-deferred-unary-formals.exp @@ -0,0 +1 @@ +[ false -2 ] diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-deferred-unary-formals.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-deferred-unary-formals.nix new file mode 100644 index 000000000000..1fbb3e853af4 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-deferred-unary-formals.nix @@ -0,0 +1,6 @@ +# Application of unary operators on deferred formals arguments (via +# defaulting), see also b/255. +[ + (({ b ? !a, a }: b) { a = true; }) + (({ b ? -a, a }: b) { a = 2; }) +] |