Files
kotlin-fork/compiler/testData/diagnostics/tests/tailRecInNestedScopes.fir.kt
T
Tianyu Geng 5252effb10 FIR checker: report tailrec problems on the keyword
FE1.0 reports it on the declaration signature. This is not ideal so we
move it to the `tailrec` keyword in FIR.
2021-09-28 22:30:09 +03:00

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<!>()
}
}