Simplify tail-call optimisation check

Check, that all suspension points are immediately followed by ARETURN
and do not check that all these ARETURNs are immediately preceded by
suspension points.
 #KT-27190 Fixed
This commit is contained in:
Ilmir Usmanov
2018-10-11 18:56:48 +03:00
parent d11fbac511
commit a5bcd3495e
4 changed files with 28 additions and 7 deletions
@@ -0,0 +1,16 @@
// WITH_RUNTIME
import kotlin.coroutines.intrinsics.*
fun check() = true
suspend fun f(i: Int): Unit {
return f_2()
}
private inline suspend fun f_2(): Unit {
if (check()) return
return suspendCoroutineUninterceptedOrReturn {
COROUTINE_SUSPENDED
}
}
@@ -0,0 +1,6 @@
@kotlin.Metadata
public final class TailCallIfReturnUnitKt {
public final static method check(): boolean
public final static @org.jetbrains.annotations.Nullable method f(p0: int, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
private synthetic final static method f_2(p0: kotlin.coroutines.Continuation): java.lang.Object
}