Overridden functions using default arguments in recursive call are no more considered tail recursive #KT-4285 Fixed

This commit is contained in:
Mikhail Glukhikh
2016-05-16 18:51:16 +03:00
parent f35fd32a25
commit a4ad995f31
7 changed files with 113 additions and 0 deletions
@@ -0,0 +1,32 @@
// See also KT-4285
open class A {
open fun foo(x: Int = 0) {}
open fun gav(y: Int = 1, z: Int = 2) {}
}
class B: A() {
<!NO_TAIL_CALLS_FOUND!>tailrec override fun foo(x: Int)<!> {
foo()
}
<!NO_TAIL_CALLS_FOUND!>tailrec override fun gav(y: Int, z: Int)<!> {
gav(y)
}
tailrec fun bar(y: Double): Double = bar(y * 2.0)
}
class C: A() {
tailrec override fun foo(x: Int) {
foo(0)
}
tailrec override fun gav(y: Int, z: Int) {
gav(y - 1, z - 1)
}
tailrec fun bar(<!UNUSED_PARAMETER!>y<!>: Int = 1, z: Int = 2) {
bar(z)
}
}