From f73891af9802720c6ec429b83e18241d346950b7 Mon Sep 17 00:00:00 2001 From: pyos Date: Tue, 14 Jan 2020 11:01:02 +0100 Subject: [PATCH] JVM_IR: actually forward the parameters to $suspendImpl --- .../backend/jvm/lower/AddContinuationLowering.kt | 10 ++-------- .../coroutines/suspendFunctionAsCoroutine/superCall.kt | 6 +++--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt index 5a01825687a..4d42e89158e 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt @@ -502,7 +502,6 @@ private class AddContinuationLowering(private val context: JvmBackendContext) : private fun createStaticSuspendImpl(irFunction: IrSimpleFunction): IrSimpleFunction { // Create static suspend impl method. - val backendContext = context val static = createStaticFunctionWithReceivers( irFunction.parent, irFunction.name.toSuspendImplementationName(), @@ -522,15 +521,10 @@ private class AddContinuationLowering(private val context: JvmBackendContext) : it.putValueArgument(i++, irGet(irFunction.dispatchReceiverParameter!!)) } if (irFunction.extensionReceiverParameter != null) { - val defaultValueForParameter = irFunction.extensionReceiverParameter!!.type.defaultValue( - UNDEFINED_OFFSET, UNDEFINED_OFFSET, backendContext - ) - it.putValueArgument(i++, defaultValueForParameter) - + it.putValueArgument(i++, irGet(irFunction.extensionReceiverParameter!!)) } for (parameter in irFunction.valueParameters) { - val defaultValueForParameter = parameter.type.defaultValue(UNDEFINED_OFFSET, UNDEFINED_OFFSET, backendContext) - it.putValueArgument(i++, defaultValueForParameter) + it.putValueArgument(i++, irGet(parameter)) } }) } diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt index 7f0e2a5c47d..d926e2958ed 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/superCall.kt @@ -12,11 +12,11 @@ open class A(val v: String) { COROUTINE_SUSPENDED } - open suspend fun suspendHere(): String = suspendThere("O") + suspendThere(v) + open suspend fun suspendHere(x: String): String = suspendThere(x) + suspendThere(v) } class B(v: String) : A(v) { - override suspend fun suspendHere(): String = super.suspendHere() + suspendThere("56") + override suspend fun suspendHere(x: String): String = super.suspendHere(x) + suspendThere("56") } fun builder(c: suspend A.() -> Unit) { @@ -27,7 +27,7 @@ fun box(): String { var result = "" builder { - result = suspendHere() + result = suspendHere("O") } if (result != "OK56") return "fail 1: $result"