From 01272cace3860e3f266968e90aac79892aa19116 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Wed, 25 Aug 2021 12:18:55 +0300 Subject: [PATCH] [K/N] don't rely on expression type when lowering value constructor calls Because of generics, these types don't exactly match the actual types in generated code, and autoboxing can't fix this because this happens after it. ^KT-48381 Fixed --- .../src/org/jetbrains/kotlin/backend/konan/lower/Autoboxing.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/Autoboxing.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/Autoboxing.kt index 79a99dc7585..5dce6db9442 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/Autoboxing.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/Autoboxing.kt @@ -457,7 +457,7 @@ private class InlineClassTransformer(private val context: Context) : IrBuildingT this.at(expression) val loweredConstructor = this@InlineClassTransformer.context.getLoweredInlineClassConstructor(callee) return if (callee.isPrimary) this.irBlock { - val argument = irTemporary(expression.getValueArgument(0)!!) + val argument = irTemporary(expression.getValueArgument(0)!!, irType = loweredConstructor.valueParameters.single().type) +irCall(loweredConstructor).apply { putValueArgument(0, irGet(argument)) }