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.
This is still not exhaustive, but it at least guards against some cases
discovered by the fuzzer.
Tail calls would likely solve this, though maybe even that is not
enough, you _could_ overflow the native stack with a very deeply nested
expression. The eventual solution might be to have a bytecode
interpreter with jumps, but for now, let's patch it ad-hoc ...
I discovered this while trying to implement and Advent of Code problem
in RCL. Everything appears to work, except that it overflows its stack.
This is tough to solve, but at least we can make it error niceley
instead of crashing. I am a bit disappointed that the fuzzer has not
discovered this yet.