From dc11c2de7703f2788bd84c65b3299a51257cc639 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Fri, 11 Dec 2020 12:24:41 +0100 Subject: [PATCH] IC Mangling: Use correct java field type if the type is inline class in JVM_IR BE. #KT-26445 --- .../jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt index fdb016e48b8..85819b6ae24 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt @@ -12,6 +12,7 @@ import org.jetbrains.kotlin.backend.jvm.JvmLoweredStatementOrigin import org.jetbrains.kotlin.backend.jvm.intrinsics.IrIntrinsicMethods import org.jetbrains.kotlin.backend.jvm.intrinsics.JavaClassProperty import org.jetbrains.kotlin.backend.jvm.ir.erasedUpperBound +import org.jetbrains.kotlin.backend.jvm.ir.isFromJava import org.jetbrains.kotlin.backend.jvm.lower.MultifileFacadeFileEntry import org.jetbrains.kotlin.backend.jvm.lower.constantValue import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.unboxInlineClass @@ -665,7 +666,8 @@ class ExpressionCodegen( ?: receiverType ?: typeMapper.mapClass(callee.parentAsClass) val ownerName = ownerType.internalName val fieldName = callee.name.asString() - val fieldType = callee.type.asmType + val calleeIrType = if (callee.isFromJava() && callee.type.isInlined()) callee.type.makeNullable() else callee.type + val fieldType = calleeIrType.asmType return if (expression is IrSetField) { val value = expression.value.accept(this, data) // We only initialize enum entries with a subtype of `fieldType` and can avoid the CHECKCAST.