Generate separate methods for inline and noinline uses of inline suspend functions

Previously, inline suspend functions were effectively inline only,
but ordinary inline functions can be used as noinline.
To fix the issue, I generate two functions: one for inline with suffix
$$forInline and without state machine; and the other one without any
suffix and state machine for direct calls.
This change does not affect effectively inline only suspend functions,
i.e. functions with reified generics, annotated with @InlineOnly
annotation and functions with crossinline parameters.
 #KT-20219: Fixed
This commit is contained in:
Ilmir Usmanov
2018-04-04 22:30:30 +03:00
parent bb4972b00e
commit 8a5ae16947
22 changed files with 528 additions and 82 deletions
@@ -0,0 +1,39 @@
// WITH_RUNTIME
suspend inline fun simple() {}
suspend inline fun <T> generic() {}
suspend inline fun <T, reified U> genericWithReified() {}
suspend inline fun Unit.simple() {}
suspend inline fun <T> T.generic() {}
suspend inline fun <T, reified U> T.genericWithReified() {}
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@kotlin.internal.InlineOnly
suspend inline fun shouldNotHaveSuffix() {}
suspend inline fun acceptsCrossinline(crossinline c: () -> Unit) {}
class Foo {
suspend inline fun simple() {}
suspend inline fun <T> generic() {}
suspend inline fun <T, reified U> genericWithReified() {}
suspend inline fun Unit.simple() {}
suspend inline fun <T> T.generic() {}
suspend inline fun <T, reified U> T.genericWithReified() {}
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@kotlin.internal.InlineOnly
suspend inline fun shouldNotHaveSuffix() {}
suspend inline fun acceptsCrossinline(crossinline c: () -> Unit) {}
}