diff options
author | Griffin Smith <root@gws.fyi> | 2022-10-10T19·57-0400 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2022-10-10T20·35+0000 |
commit | 25921134353e785b509d4debeb11b3bf209c92b3 (patch) | |
tree | b570ab1d762108121f93b22ee77da39ed8567e54 /tvix/eval/src/tests/tvix_tests | |
parent | 4fd18cbc9a756ea51dd04fa7bde9cfc79f4f8fa3 (diff) |
fix(tvix/eval): Thunk `if` expr r/5090
Since the body of an `if` expr can refer to deferred upvalues, it needs to be thunked so when we actually compile those deferred upvalues we have something for the finalize op to point at. Without this all sorts of weird things can happen due to the finalize op being run in the wrong lambda context, up to and including a panic. Change-Id: I040d5e1a7232fd841cfa4953539898fa49cbbb83 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6929 Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/tests/tvix_tests')
-rw-r--r-- | tvix/eval/src/tests/tvix_tests/eval-okay-thunked-if.exp | 1 | ||||
-rw-r--r-- | tvix/eval/src/tests/tvix_tests/eval-okay-thunked-if.nix | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-thunked-if.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-thunked-if.exp new file mode 100644 index 000000000000..ffcd4415b08f --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-thunked-if.exp @@ -0,0 +1 @@ +{ } diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-thunked-if.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-thunked-if.nix new file mode 100644 index 000000000000..65e9e66d74dc --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-thunked-if.nix @@ -0,0 +1,6 @@ +let + a = {}; +in let + c = if builtins.isFunction a then a b else a; + b = {}; +in c |