JVM_IR: wrap inline suspend references in suspend lambdas
This commit is contained in:
+1
@@ -119,6 +119,7 @@ internal fun IrFunction.isKnownToBeTailCall(): Boolean =
|
||||
JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR,
|
||||
JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE,
|
||||
JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC,
|
||||
JvmLoweredDeclarationOrigin.GENERATED_MEMBER_IN_CALLABLE_REFERENCE,
|
||||
IrDeclarationOrigin.BRIDGE,
|
||||
IrDeclarationOrigin.BRIDGE_SPECIAL,
|
||||
IrDeclarationOrigin.DELEGATED_MEMBER -> true
|
||||
|
||||
+1
@@ -653,6 +653,7 @@ private class AddContinuationLowering(private val context: JvmBackendContext) :
|
||||
function.body == null ||
|
||||
function.parentAsClass.origin == JvmLoweredDeclarationOrigin.FUNCTION_REFERENCE_IMPL ||
|
||||
function.origin == IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER ||
|
||||
function.origin == JvmLoweredDeclarationOrigin.GENERATED_MEMBER_IN_CALLABLE_REFERENCE ||
|
||||
function.origin == JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE
|
||||
|
||||
private fun skip(function: IrFunction) =
|
||||
|
||||
+3
-3
@@ -127,7 +127,7 @@ internal class InlineCallableReferenceToLambdaPhase(val context: JvmBackendConte
|
||||
name = Name.identifier("stub_for_inlining")
|
||||
visibility = Visibilities.LOCAL
|
||||
returnType = referencedFunction.returnType
|
||||
isSuspend = false
|
||||
isSuspend = referencedFunction.isSuspend
|
||||
}.apply {
|
||||
for ((index, argumentType) in argumentTypes.withIndex()) {
|
||||
addValueParameter {
|
||||
@@ -137,12 +137,12 @@ internal class InlineCallableReferenceToLambdaPhase(val context: JvmBackendConte
|
||||
}
|
||||
|
||||
body = this@InlineCallableReferenceToLambdaPhase.context.createJvmIrBuilder(
|
||||
this.symbol,
|
||||
symbol,
|
||||
expression.startOffset,
|
||||
expression.endOffset
|
||||
).run {
|
||||
irExprBody(irCall(referencedFunction).apply {
|
||||
this@apply.symbol.owner.allTypeParameters.forEach {
|
||||
symbol.owner.allTypeParameters.forEach {
|
||||
putTypeArgument(it.index, expression.getTypeArgument(it.index))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// !LANGUAGE: +ReleaseCoroutines
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JVM_IR, JS_IR, NATIVE
|
||||
// IGNORE_BACKEND: JS_IR, NATIVE
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
import helpers.*
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
// !LANGUAGE: +ReleaseCoroutines
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: test.kt
|
||||
|
||||
|
||||
Reference in New Issue
Block a user