Files
kotlin-fork/compiler/testData/diagnostics/tests/tailRecSingleton.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

54 lines
876 B
Kotlin
Vendored

object Foo {
tailrec fun foo1() {
foo1()
}
tailrec fun foo2() {
this.foo2()
}
tailrec fun foo3() {
Foo.foo3()
}
}
class Bar {
companion object {
tailrec fun bar1() {
bar1()
}
tailrec fun bar2() {
this.bar2()
}
tailrec fun bar3() {
Bar.bar3()
}
tailrec fun bar4() {
Bar.Companion.bar4()
}
}
}
enum class E {
A {
override tailrec fun rec() {
rec()
}
},
B {
override tailrec fun rec() {
this.rec()
}
},
C {
override <!NO_TAIL_CALLS_FOUND!>tailrec<!> fun rec() {
C.rec() // resolution goes to `E.rec`. Hence the resolved symbol is considered different from `C.rec`.
}
};
abstract fun rec()
}