about summary refs log blame commit diff
path: root/tvix/eval/src/tests/tvix_tests/eval-okay-formals-miscompilation-b-261-regression.nix
blob: 43bef2938df516c502353689c0584b2f404b9511 (plain) (tree)



















                                                                             
# This is a regression test for https://b.tvl.fyi/261.
#
# The bug occurred when Tvix would unconditionally finalise the stack slot of
# `finalise` (as its default expression needs a finaliser): Finalising an
# manually provided, already forced thunk would cause the VM to crash.
let
  thunk = x: x;
  bomb = thunk true;
  f =
    { finalise ? later == null
    , later ? null
    }:
    [ finalise later ];
in

# Note that the crash did not occur if the offending expression was the rhs
# argument to `builtins.seq`, hence we need to put the assert in between.
assert builtins.seq bomb true;

f { finalise = bomb; }