From 6bc44a366af886d2d3d2c8f03dc7deba1bc58467 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Mon, 20 Jul 2020 12:33:23 +0300 Subject: [PATCH] JVM_IR: fields for suspend lambda parameters are synthetic --- .../kotlin/backend/jvm/lower/AddContinuationLowering.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 829b1c5334f..28677625734 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 @@ -176,7 +176,13 @@ private class AddContinuationLowering(private val context: JvmBackendContext) : val receiverField = info.function.extensionReceiverParameter?.let { assert(info.arity != 0) // Do not put '$' at the start, to avoid being caught by inlineCodegenUtils.isCapturedFieldName() - addField("p\$", it.type) + addField { + name = Name.identifier("p\$") + // NB extension receiver can't be crossinline + origin = LocalDeclarationsLowering.DECLARATION_ORIGIN_FIELD_FOR_CAPTURED_VALUE + type = it.type + visibility = Visibilities.PRIVATE + } } val parametersFields = info.function.valueParameters.map {