diff options
Diffstat (limited to 'test/testdata/eval-fail-mutual-recursion.nix')
-rw-r--r-- | test/testdata/eval-fail-mutual-recursion.nix | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/testdata/eval-fail-mutual-recursion.nix b/test/testdata/eval-fail-mutual-recursion.nix new file mode 100644 index 0000000..d090d31 --- /dev/null +++ b/test/testdata/eval-fail-mutual-recursion.nix | |||
@@ -0,0 +1,36 @@ | |||
1 | # Check that stack frame deduplication only affects consecutive intervals, and | ||
2 | # that they are reported independently of any preceding sections, even if | ||
3 | # they're indistinguishable. | ||
4 | # | ||
5 | # In terms of the current implementation, we check that we clear the set of | ||
6 | # "seen frames" after eliding a group of frames. | ||
7 | # | ||
8 | # Suppose we have: | ||
9 | # - 10 frames in a function A | ||
10 | # - 10 frames in a function B | ||
11 | # - 10 frames in a function A | ||
12 | # | ||
13 | # We want to output: | ||
14 | # - a few frames of A (skip the rest) | ||
15 | # - a few frames of B (skip the rest) | ||
16 | # - a few frames of A (skip the rest) | ||
17 | # | ||
18 | # If we implemented this in the naive manner, we'd instead get: | ||
19 | # - a few frames of A (skip the rest) | ||
20 | # - a few frames of B (skip the rest, _and_ skip the remaining frames of A) | ||
21 | let | ||
22 | throwAfterB = recurse: n: | ||
23 | if n > 0 | ||
24 | then throwAfterB recurse (n - 1) | ||
25 | else if recurse | ||
26 | then throwAfterA false 10 | ||
27 | else throw "Uh oh!"; | ||
28 | |||
29 | throwAfterA = recurse: n: | ||
30 | if n > 0 | ||
31 | then throwAfterA recurse (n - 1) | ||
32 | else if recurse | ||
33 | then throwAfterB true 10 | ||
34 | else throw "Uh oh!"; | ||
35 | in | ||
36 | throwAfterA true 10 | ||