8525b4932b
Difference from FE1.0 * KT-4285: calls to virtual method with default argument should be reported as not tailrec. FE1.0 is missing such cases. * KT-48600: calls inside lambda should be reported as not tailrec. FE1.0 also misses such cases.
29 lines
599 B
Kotlin
Vendored
29 lines
599 B
Kotlin
Vendored
// KT-16549
|
|
// IGNORE_BACKEND: JVM
|
|
// IGNORE_FIR_DIAGNOSTICS_DIFF
|
|
|
|
class TailInline {
|
|
private inline fun act(action: () -> Unit) {
|
|
return action()
|
|
}
|
|
|
|
private var countDown = 10
|
|
|
|
tailrec fun test(): Int {
|
|
if (countDown < 5) return countDown
|
|
act {
|
|
countDown--
|
|
if (countDown < 1)
|
|
return countDown
|
|
else
|
|
return test() // GOTO countDown--
|
|
}
|
|
return countDown
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
val result = TailInline().test()
|
|
return if (result == 4) "OK" else "Fail: $result"
|
|
}
|