## Compiler version 3.4.1 ## Minimized code <!-- This code should be self contained, compilable (with possible failures) and as small as possible. Ideally, we should be able to just copy this code in a file and run `scalac` (and maybe `scala`) to reproduce the issue. --> ```Scala 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.