Closed
Description
import annotation.tailrec
class Test {
@inline @tailrec def rec(x: Int): Int = {
if (x > 0) rec(x - 1)
else 0
}
def bar = rec(100)
}
fails to compile with Dotty
-- Error: tests/allan/Test.scala:25:18 -----------------------------------------
25 | if (x > 0) rec(x - 1)
| ^^^^^^^^^^
| Maximal number of successive inlines (32) exceeded,
| Maybe this is caused by a recursive inline method?
| You can use -Xmax:inlines to change the limit.
| This location is in code that was inlined at tests/allan/Test.scala:25
Scalac does not have this limitation because inlining happens after the tailrec optimisation.
I believe this change of behavior might break a lot of code, and we should turn the error into a warning.