Open rcano opened 1 year ago
I don't understand why the last recursion seems to kill it when the type itself, is not even being used, it's just being defined (i.e, not applied over an actual Board in a way that it would have to run all the type matches).
Some element of answer: that match can actually be expanded quite a lot, because Pos
is known, and the recursion can unfold 81 times without looking at B
, internally creating a gigantic type in the process. That may be what's killing the typechecker.
I originally tried with a much smaller number, like 10, same result. I can try with a much a smaller number.
So with a limit of 2 cells in Solve
, it completed in something less than 20 seconds, with a limit of 4 it's been 10 minutes compiling and no result.
What I don't quite understand is that there's a fixed number of iterations per cell, so when you go from 2 cells to 4, I'd expect an extra compilation time that's proportional, instead of this seemingly exponential situation. JVisualVm doesn't show the compiler going crazy with allocation rates, just cpu spinning.
Compiler version
3.3.0-RC4 (but also versions prior)
Minimized code
Output
The compiler goes into an seemingly infinite loop, as it never ends. If you comment out the
Solve
type at the bottom, then it compiles pretty quickly (but if you switch theSolve
for theAlternativeSolve
, you also get the infinite recursion). Also note that all the intermediate step work fine (as tested elsewhere). I don't understand why the last recursion seems to kill it when the type itself, is not even being used, it's just being defined (i.e, not applied over an actual Board in a way that it would have to run all the type matches).Expectation
The typer should at least return. Can't even say the typer is correct or wrong, because it just doesn't produce a result ever.