IR: make calls with explicit singleton receiver tailrec [KT-48602]
This commit is contained in:
committed by
TeamCityServer
parent
8525b4932b
commit
3c84fbcab1
@@ -7,8 +7,8 @@ object Foo {
|
||||
this.foo2()
|
||||
}
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun foo3()<!> {
|
||||
Foo.<!NON_TAIL_RECURSIVE_CALL!>foo3<!>()
|
||||
tailrec fun foo3() {
|
||||
Foo.foo3()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,12 @@ class Bar {
|
||||
this.bar2()
|
||||
}
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun bar3()<!> {
|
||||
Bar.<!NON_TAIL_RECURSIVE_CALL!>bar3<!>()
|
||||
tailrec fun bar3() {
|
||||
Bar.bar3()
|
||||
}
|
||||
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun bar4()<!> {
|
||||
Bar.Companion.<!NON_TAIL_RECURSIVE_CALL!>bar4<!>()
|
||||
tailrec fun bar4() {
|
||||
Bar.Companion.bar4()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
object O {
|
||||
// foo is the same, but the compiler currently doesn't compile this as tail recursive. See KT-48602
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun foo(i: Int): Int<!> = if (i < 0) 0 else O.<!NON_TAIL_RECURSIVE_CALL!>foo<!>(i - 1)
|
||||
}
|
||||
|
||||
class A {
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun foo(i: Int)<!> = if (i < 0) 0 else A.foo(i - 1)
|
||||
|
||||
companion object {
|
||||
fun foo(i: Int) = 42 + i
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
<!NO_TAIL_CALLS_FOUND!>tailrec fun foo(i: Int)<!> = if (i < 0) 0 else O.foo(i - 1)
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// FIR_IDENTICAL
|
||||
object O {
|
||||
// foo is the same, but the compiler currently doesn't compile this as tail recursive. See KT-48602
|
||||
// tailrec since `O` is a singleton
|
||||
tailrec fun foo(i: Int): Int = if (i < 0) 0 else O.foo(i - 1)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user