JVM_IR: Do not unbox Result argument inside java SAM adapters

#KT-45259
This commit is contained in:
Ilmir Usmanov
2021-03-12 22:59:52 +01:00
parent 4099dfc7e0
commit 149064803d
6 changed files with 57 additions and 5 deletions
@@ -661,6 +661,9 @@ class ExpressionCodegen(
} || irFunction.parentAsClass.let { it.origin == JvmLoweredDeclarationOrigin.LAMBDA_IMPL && !it.isSamAdapter() }
if (!genericOrAnyOverride) return
// Result parameter of SAM-wrapper to Java SAM is already unboxed in visitGetValue, do not unbox it anymore
if (irFunction.parentAsClass.superTypes.any { it.getClass()?.isFromJava() == true }) return
StackValue.unboxInlineClass(OBJECT_TYPE, arg.type.erasedUpperBound.defaultType.toIrBasedKotlinType(), mv)
}