diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/DeepCopyIrTreeWithDescriptoros.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/DeepCopyIrTreeWithDescriptoros.kt index f63af8e0044..66d4bccd2c3 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/DeepCopyIrTreeWithDescriptoros.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/DeepCopyIrTreeWithDescriptoros.kt @@ -54,10 +54,7 @@ internal class DeepCopyIrTreeWithDescriptors(val targetScope: ScopeWithIr, fun copy(irElement: IrElement, typeSubstitutor: TypeSubstitutor?): IrElement { this.typeSubstitutor = typeSubstitutor - descriptorSubstituteMap.clear() irElement.acceptChildrenVoid(DescriptorCollector()) - // Transform calls to object that might be returned from inline function call. - targetScope.irElement.transformChildrenVoid(descriptorSubstitutorForExternalScope) return irElement.accept(InlineCopyIr(), null) } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionInlining.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionInlining.kt index 23b73f1b730..29821c4d8c3 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionInlining.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionInlining.kt @@ -68,7 +68,10 @@ internal class FunctionInlining(val context: Context): IrElementTransformerVoidW copyIrElement = DeepCopyIrTreeWithDescriptors(currentScope!!, context) // Create DeepCopy for current scope. functionDeclaration.transformChildrenVoid(this) // Process recursive inline. - return inlineFunction(irCall, functionDeclaration) // Return newly created IrInlineBody instead of IrCall. + val inlineFunctionBody = inlineFunction(irCall, functionDeclaration) // Return newly created IrInlineBody instead of IrCall. + currentScope!!.irElement.transformChildrenVoid( // Transform calls to object that might be returned from inline function call. + copyIrElement!!.descriptorSubstitutorForExternalScope) + return inlineFunctionBody } //-------------------------------------------------------------------------//