IC Mangling: Do not mangle functions with inline classes from Java
in JVM_IR BE. Map types to boxed variants, when mapping signatures. #KT-26445
This commit is contained in:
+7
-2
@@ -195,7 +195,8 @@ class MethodSignatureMapper(private val context: JvmBackendContext) {
|
||||
|
||||
// See also: KotlinTypeMapper.forceBoxedReturnType
|
||||
private fun forceBoxedReturnType(function: IrFunction): Boolean =
|
||||
isBoxMethodForInlineClass(function) || forceFoxedReturnTypeOnOverride(function) || forceBoxedReturnTypeOnDefaultImplFun(function)
|
||||
isBoxMethodForInlineClass(function) || forceFoxedReturnTypeOnOverride(function) || forceBoxedReturnTypeOnDefaultImplFun(function) ||
|
||||
function.isFromJava() && function.returnType.isInlined()
|
||||
|
||||
private fun forceFoxedReturnTypeOnOverride(function: IrFunction) =
|
||||
function is IrSimpleFunction &&
|
||||
@@ -320,7 +321,11 @@ class MethodSignatureMapper(private val context: JvmBackendContext) {
|
||||
|
||||
private fun writeParameterType(sw: JvmSignatureWriter, type: IrType, declaration: IrDeclaration) {
|
||||
if (sw.skipGenericSignature()) {
|
||||
typeMapper.mapType(type, TypeMappingMode.DEFAULT, sw)
|
||||
if (type.isInlined() && declaration.isFromJava()) {
|
||||
typeMapper.mapType(type, TypeMappingMode.GENERIC_ARGUMENT, sw)
|
||||
} else {
|
||||
typeMapper.mapType(type, TypeMappingMode.DEFAULT, sw)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ class MemoizedInlineClassReplacements(
|
||||
}
|
||||
|
||||
// Otherwise, mangle functions with mangled parameters, ignoring constructors
|
||||
it is IrSimpleFunction && (it.hasMangledParameters || mangleReturnTypes && it.hasMangledReturnType) ->
|
||||
it is IrSimpleFunction && !it.isFromJava() && (it.hasMangledParameters || mangleReturnTypes && it.hasMangledReturnType) ->
|
||||
if (it.dispatchReceiverParameter != null)
|
||||
createMethodReplacement(it)
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user