Open skilchen opened 6 years ago
Duplicate of #8432 (Closure + Generics leads to VM stack overflow)?
Duplicate of #8432 (Closure + Generics leads to VM stack overflow)?
Nope, just a simple case of undetected co-recursion during the parameter lifting phase: the compiler tries to lift B
from A
and then A
from B
and so on.
Here's a fun one I managed to generate. Yeah, I know it's bogus and all, but it seems like it might make a good test case.
type
string = string
pigs = object
horses: string
The compilation of this contrived example will never end: It doesn't matter, what follows the type section. The compiler will not see it.
I know, that this is silly Nim code, but nevertheless the compiler should not loop forever.
If you like silly contrivances, here is another one. This one only works if you compile using
-d:makemecompile
:The else branch where the
echo kind(b)
is called, will never be executed. But without thisecho kind(b)
, Nim will generate uncompileable C code...