Fix Java interop of inline suspend functions with suspend parameters

In 1.3.31 I fixed Java interop for inline function with coroutines
(TL;DR: when we need a state machine, generate two methods: one with
normal name, and the other one with $$forInline suffix, for the inliner
to use, just like inline suspend functions), however, I forgot a case
with inline suspend function with inline suspend function parameter.
In this case, the compiler a generated two functions, as needed, but,
neither of them had a state-machine. This change adds the state-machine
for the method with normal name. Note, that suspend inline functions
with crossinline parameter, which are also supported by the change,
did not cause incorrect behaviour, since until now they were generated
as synthetic.

 #KT-31354 Fixed
This commit is contained in:
Ilmir Usmanov
2019-05-08 02:19:35 +03:00
parent 2b9e05e30f
commit 266976ac1e
14 changed files with 293 additions and 26 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -18,8 +18,7 @@ fun MemberDescriptor.isInlineOnlyOrReifiable(): Boolean =
this is CallableMemberDescriptor && (isReifiable() || DescriptorUtils.getDirectMember(this).isReifiable() || isInlineOnly())
fun MemberDescriptor.isEffectivelyInlineOnly(): Boolean =
isInlineOnlyOrReifiable() || (this is FunctionDescriptor && isSuspend && isInline &&
(valueParameters.any { it.isCrossinline } || visibility == Visibilities.PRIVATE))
isInlineOnlyOrReifiable() || (this is FunctionDescriptor && isSuspend && isInline && visibility == Visibilities.PRIVATE)
fun MemberDescriptor.isInlineOnly(): Boolean =
this is FunctionDescriptor && isInline &&