FIR Checker: check tailrec

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.
This commit is contained in:
Tianyu Geng
2021-09-02 11:00:45 -07:00
committed by TeamCityServer
parent 5df316a129
commit 8525b4932b
55 changed files with 876 additions and 216 deletions
@@ -6,12 +6,12 @@ open class A {
}
class B: A() {
tailrec override fun foo(x: Int) {
foo()
<!NO_TAIL_CALLS_FOUND!>tailrec override fun foo(x: Int)<!> {
<!NON_TAIL_RECURSIVE_CALL!>foo<!>()
}
tailrec override fun gav(y: Int, z: Int) {
gav(y)
<!NO_TAIL_CALLS_FOUND!>tailrec override fun gav(y: Int, z: Int)<!> {
<!NON_TAIL_RECURSIVE_CALL!>gav<!>(y)
}
tailrec fun bar(y: Double): Double = bar(y * 2.0)
@@ -29,4 +29,4 @@ class C: A() {
tailrec fun bar(y: Int = 1, z: Int = 2) {
bar(z)
}
}
}