Closed
Description
Compiler version
3.4.1
Minimized code
import scala.annotation.tailrec
@tailrec
def foo(i: Int): Int = {
if (i > 10000000) {
i
} else {
val bar: String = {
return foo(i + 1)
"foo"
}
-1
}
}
println(foo(0))
Output
Stack overflow error on the line return foo(i + 1)
Expectation
10000001 should be prited to the console - or if it is determined this is not a tail location - it shoud fail to compile.