[JVM IR] Fix issue with destructuring declaration in parameter for

suspend lambda.

The Name for the special destructuring declaration parameter was
incorrectly turned into a regular/non-special Name when the parameter
was moved to a field.
This commit is contained in:
Mark Punzalan
2020-01-07 14:20:35 -08:00
committed by Ilmir Usmanov
parent 36c4df6d99
commit 137ef26723
4 changed files with 6 additions and 5 deletions
@@ -63,13 +63,16 @@ inline fun IrDeclarationContainer.addField(builder: IrFieldBuilder.() -> Unit) =
declarations.add(field)
}
fun IrClass.addField(fieldName: String, fieldType: IrType, fieldVisibility: Visibility = Visibilities.PRIVATE): IrField =
fun IrClass.addField(fieldName: Name, fieldType: IrType, fieldVisibility: Visibility = Visibilities.PRIVATE): IrField =
addField {
name = Name.identifier(fieldName)
name = fieldName
type = fieldType
visibility = fieldVisibility
}
fun IrClass.addField(fieldName: String, fieldType: IrType, fieldVisibility: Visibility = Visibilities.PRIVATE): IrField =
addField(Name.identifier(fieldName), fieldType, fieldVisibility)
fun IrPropertyBuilder.buildProperty(): IrProperty {
val wrappedDescriptor = WrappedPropertyDescriptor()
return IrPropertyImpl(
@@ -114,7 +114,7 @@ private class AddContinuationLowering(private val context: JvmBackendContext) :
addField("p\$", it.type)
}
val parametersFields = info.function.valueParameters.map { addField(it.name.asString(), it.type) }
val parametersFields = info.function.valueParameters.map { addField(it.name, it.type) }
val parametersWithoutArguments = parametersFields.withIndex()
.mapNotNull { (i, field) -> if (info.reference.getValueArgument(i) == null) field else null }
val parametersWithArguments = parametersFields - parametersWithoutArguments
@@ -1,5 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
@@ -1,5 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST