1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 22:11:15 +02:00
nix/tests/functional/lang/eval-fail-mutual-recursion.nix
Robert Hensing 96e550efc5 Format .nix files
... with nixfmt (rfc style)
2025-01-24 17:04:02 +01:00

40 lines
1.1 KiB
Nix

# Check that stack frame deduplication only affects consecutive intervals, and
# that they are reported independently of any preceding sections, even if
# they're indistinguishable.
#
# In terms of the current implementation, we check that we clear the set of
# "seen frames" after eliding a group of frames.
#
# Suppose we have:
# - 10 frames in a function A
# - 10 frames in a function B
# - 10 frames in a function A
#
# We want to output:
# - a few frames of A (skip the rest)
# - a few frames of B (skip the rest)
# - a few frames of A (skip the rest)
#
# If we implemented this in the naive manner, we'd instead get:
# - a few frames of A (skip the rest)
# - a few frames of B (skip the rest, _and_ skip the remaining frames of A)
let
throwAfterB =
recurse: n:
if n > 0 then
throwAfterB recurse (n - 1)
else if recurse then
throwAfterA false 10
else
throw "Uh oh!";
throwAfterA =
recurse: n:
if n > 0 then
throwAfterA recurse (n - 1)
else if recurse then
throwAfterB true 10
else
throw "Uh oh!";
in
throwAfterA true 10