Generate state-machine even if the object is going to be transformed

This fixes Java interop of inline functions, which use coroutines.
However, we cannot transform the state-machine. Thus, we generate
a $$forInline counterpart for suspend functions (similar to inline
suspend functions) and invokeSuspend$$forInline for lambdas if these
coroutines are going to transformed (i.e. are declared inside inline
functions).
During transformation we just skip method with state-machine and
transform the $$forInline counterpart. Of course, if inline site is
inline itself, we generate both state-machine version (which will be
dropped during the next transformation) and $$forInline version.
Consequently, the final version of the coroutines will not have
$$forInline counterpart.
Unfortunately, since CompileKotlinAgainstInlineKotlin tests do not allow
java sources, the tests for the interop are usual box tests.

 #KT-30707 Fixed
This commit is contained in:
Ilmir Usmanov
2019-04-01 19:00:46 +03:00
parent fe8bf98bce
commit 20b9d8b2f3
26 changed files with 753 additions and 157 deletions
@@ -41,6 +41,7 @@ final class CoroutineFieldsKt$box$1 {
field J$0: long
field L$0: java.lang.Object
field L$1: java.lang.Object
field L$2: java.lang.Object
private field p$: Controller
inner class CoroutineFieldsKt$box$1
method <init>(p0: kotlin.jvm.internal.Ref$ObjectRef, p1: COROUTINES_PACKAGE.Continuation): void
@@ -40,6 +40,7 @@ final class CoroutineFieldsKt$box$1 {
field J$0: long
field L$0: java.lang.Object
field L$1: java.lang.Object
field L$2: java.lang.Object
field label: int
private field p$: Controller
inner class CoroutineFieldsKt$box$1