IC Mangling: Correctly mangle functions with generic return type
if the type's parent is inline class. #KT-43050 Fixed #KT-26130 Fixed #KT-32384 Fixed
This commit is contained in:
+1
-1
@@ -132,7 +132,7 @@ object InlineClassAbi {
|
||||
private fun IrType.asInfoForMangling(): InfoForMangling =
|
||||
InfoForMangling(
|
||||
erasedUpperBound.fqNameWhenAvailable!!.toUnsafe(),
|
||||
isInline = getClass()?.isInline == true,
|
||||
isInline = erasedUpperBound.isInline,
|
||||
isNullable = isNullable()
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
inline class X(val x: Any?)
|
||||
|
||||
interface IFoo<out T : X?> {
|
||||
fun foo(): T
|
||||
}
|
||||
|
||||
fun <T : X> foo(x: T) {}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
@kotlin.Metadata
|
||||
public final class GenericChildKt {
|
||||
// source: 'genericChild.kt'
|
||||
public final static method foo-p_PkZps(@org.jetbrains.annotations.NotNull p0: java.lang.Object): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public interface IFoo {
|
||||
// source: 'genericChild.kt'
|
||||
public abstract method foo-HezMcGQ(): X
|
||||
}
|
||||
|
||||
@kotlin.jvm.JvmInline
|
||||
@kotlin.Metadata
|
||||
public final class X {
|
||||
// source: 'genericChild.kt'
|
||||
private final @org.jetbrains.annotations.Nullable field x: java.lang.Object
|
||||
private synthetic method <init>(p0: java.lang.Object): void
|
||||
public synthetic final static method box-impl(p0: java.lang.Object): X
|
||||
public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.Nullable p0: java.lang.Object): java.lang.Object
|
||||
public method equals(p0: java.lang.Object): boolean
|
||||
public static method equals-impl(p0: java.lang.Object, p1: java.lang.Object): boolean
|
||||
public final static method equals-impl0(p0: java.lang.Object, p1: java.lang.Object): boolean
|
||||
public final @org.jetbrains.annotations.Nullable method getX(): java.lang.Object
|
||||
public method hashCode(): int
|
||||
public static method hashCode-impl(p0: java.lang.Object): int
|
||||
public method toString(): java.lang.String
|
||||
public static method toString-impl(p0: java.lang.Object): java.lang.String
|
||||
public synthetic final method unbox-impl(): java.lang.Object
|
||||
}
|
||||
+5
@@ -1007,6 +1007,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMethodsInInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericChild.kt")
|
||||
public void testGenericChild() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/genericChild.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineCharSequence.kt")
|
||||
public void testInlineCharSequence() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence.kt");
|
||||
|
||||
+5
-5
@@ -13489,11 +13489,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/inlineClassWithCustomEquals.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multifileClass.kt")
|
||||
public void ignoreMultifileClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleSecondaryConstructor.kt")
|
||||
public void ignoreSimpleSecondaryConstructor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/simpleSecondaryConstructor.kt");
|
||||
@@ -14142,6 +14137,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mappingOfBoxedFlexibleInlineClassType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multifileClass.kt")
|
||||
public void testMultifileClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/multifileClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedInlineClass.kt")
|
||||
public void testNestedInlineClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/nestedInlineClass.kt");
|
||||
|
||||
+5
@@ -1007,6 +1007,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
|
||||
runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/defaultInterfaceMethodsInInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericChild.kt")
|
||||
public void testGenericChild() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/genericChild.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineCharSequence.kt")
|
||||
public void testInlineCharSequence() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/inlineClasses/inlineCharSequence.kt");
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ fun requiresFunctionNameManglingForParameterTypes(descriptor: CallableMemberDesc
|
||||
fun requiresFunctionNameManglingForReturnType(descriptor: CallableMemberDescriptor): Boolean {
|
||||
if (descriptor.containingDeclaration !is ClassDescriptor) return false
|
||||
val returnType = descriptor.returnType ?: return false
|
||||
return returnType.isInlineClassType()
|
||||
return returnType.isInlineClassType() || returnType.isTypeParameterWithUpperBoundThatRequiresMangling()
|
||||
}
|
||||
|
||||
fun DeclarationDescriptor.isInlineClassThatRequiresMangling(): Boolean =
|
||||
|
||||
Reference in New Issue
Block a user