rcl/golden/error/recursion_timeout.test
Ruud van Asseldonk bb34ecb643 Adjust stack depth counter again to avoid overflow
The bad input 3 was discovered by the fuzzer after I did the expansion.
I fixed it by lowering the limit, then it immediately discovered input
4 which had the same structure. So the right solution here is to add
more depth counters. It might mean that we double-count function calls,
but it does help.
2024-02-24 21:54:35 +01:00

46 lines
1.2 KiB
Text

// This is a regression test. This input used to hang indefinitely.
// The outer g on the gg is required, without it we terminate to a function.
// The inner g on the gg is required as well, otherwise we also terminate.
// The k in "h => k => ..." is also needed, without it we do hit stack error.
// In the inner call gg(h), if we use gg(k) instead, we also hit stack error.
let f = g => g(g(h => k => g(g(h))));
f(f)
# output:
stdin:6:29
6 │ let f = g => g(g(h => k => g(g(h))));
╵ ^
Error: Evaluation budget exceeded. This expression exceeds the maximum of 10000 steps.
stdin:6:15
6 │ let f = g => g(g(h => k => g(g(h))));
╵ ^
In call to function.
stdin:6:31
6 │ let f = g => g(g(h => k => g(g(h))));
╵ ^
In call to function.
stdin:6:15
6 │ let f = g => g(g(h => k => g(g(h))));
╵ ^
In call to function.
stdin:6:29
6 │ let f = g => g(g(h => k => g(g(h))));
╵ ^
In call to function.
stdin:6:15
6 │ let f = g => g(g(h => k => g(g(h))));
╵ ^
In call to function.
Note: The call stack is too deep to display in full. Only the innermost calls are shown above.