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.
38 lines
667 B
Kotlin
Vendored
38 lines
667 B
Kotlin
Vendored
// WITH_STDLIB
|
|
|
|
<!NO_TAIL_CALLS_FOUND!>tailrec fun foo1()<!> {
|
|
run {
|
|
<!NON_TAIL_RECURSIVE_CALL!>foo1<!>()
|
|
}
|
|
}
|
|
|
|
fun myRun(f: () -> Unit) = f()
|
|
|
|
|
|
<!NO_TAIL_CALLS_FOUND!>tailrec fun foo2()<!> {
|
|
myRun {
|
|
<!NON_TAIL_RECURSIVE_CALL!>foo2<!>()
|
|
}
|
|
}
|
|
|
|
<!NO_TAIL_CALLS_FOUND!>tailrec fun foo3()<!> {
|
|
fun bar() {
|
|
<!NON_TAIL_RECURSIVE_CALL!>foo3<!>()
|
|
}
|
|
bar()
|
|
}
|
|
|
|
class A {
|
|
<!NO_TAIL_CALLS_FOUND!>tailrec fun foo4()<!> {
|
|
with(this) {
|
|
<!NON_TAIL_RECURSIVE_CALL!>foo4<!>()
|
|
}
|
|
}
|
|
}
|
|
|
|
<!NO_TAIL_CALLS_FOUND!>tailrec fun foo5()<!> {
|
|
run {
|
|
return <!NON_TAIL_RECURSIVE_CALL!>foo5<!>()
|
|
}
|
|
}
|