Don't lost type parameters for members of inline classes in the bytecode
#KT-33157 Fixed
This commit is contained in:
@@ -805,6 +805,7 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
||||
receiverTypeAndTypeParameters.receiverType
|
||||
}
|
||||
!isIrBackend && kind == OwnerKind.ERASED_INLINE_CLASS -> {
|
||||
writeFormalTypeParameters(directMember.typeParameters, sw)
|
||||
(directMember.containingDeclaration as ClassDescriptor).defaultType
|
||||
}
|
||||
else -> {
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// FILE: a.kt
|
||||
|
||||
inline class IC(val v: Int) {
|
||||
fun <T> getT(): T? = null
|
||||
}
|
||||
|
||||
// FILE: UseIC.java
|
||||
|
||||
public class UseIC {
|
||||
private IC ic = null;
|
||||
|
||||
public static String result() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
fun box(): String {
|
||||
return UseIC.result()
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
inline class SomeClass(val v: Int) {
|
||||
companion object {
|
||||
fun <T> comp(s: SomeClass, t: T): T? = null
|
||||
}
|
||||
|
||||
fun <T> getT(): T? = null
|
||||
|
||||
fun <T, K> getTK(t: T): K? = null
|
||||
|
||||
val <K> K.propK: K? get() = null
|
||||
}
|
||||
|
||||
// method: SomeClass::getT-impl
|
||||
// jvm signature: (I)Ljava/lang/Object;
|
||||
// generic signature: <T:Ljava/lang/Object;>(I)TT;
|
||||
|
||||
// method: SomeClass::getTK-impl
|
||||
// jvm signature: (ILjava/lang/Object;)Ljava/lang/Object;
|
||||
// generic signature: <T:Ljava/lang/Object;K:Ljava/lang/Object;>(ITT;)TK;
|
||||
|
||||
// method: SomeClass::getPropK-impl
|
||||
// jvm signature: (ILjava/lang/Object;)Ljava/lang/Object;
|
||||
// generic signature: <K:Ljava/lang/Object;>(ITK;)TK;
|
||||
|
||||
// method: SomeClass$Companion::comp-Uh6wWds
|
||||
// jvm signature: (ILjava/lang/Object;)Ljava/lang/Object;
|
||||
// generic signature: <T:Ljava/lang/Object;>(ITT;)TT;
|
||||
+5
@@ -12720,6 +12720,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/useInlineFunctionInsideInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("useOfInlineClassWithGenericMethodFromJava.kt")
|
||||
public void testUseOfInlineClassWithGenericMethodFromJava() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/useOfInlineClassWithGenericMethodFromJava.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("useThisInsideInlineClass.kt")
|
||||
public void testUseThisInsideInlineClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/useThisInsideInlineClass.kt");
|
||||
|
||||
+5
@@ -12720,6 +12720,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/useInlineFunctionInsideInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("useOfInlineClassWithGenericMethodFromJava.kt")
|
||||
public void testUseOfInlineClassWithGenericMethodFromJava() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/useOfInlineClassWithGenericMethodFromJava.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("useThisInsideInlineClass.kt")
|
||||
public void testUseThisInsideInlineClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/useThisInsideInlineClass.kt");
|
||||
|
||||
+5
@@ -11610,6 +11610,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/useInlineFunctionInsideInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("useOfInlineClassWithGenericMethodFromJava.kt")
|
||||
public void testUseOfInlineClassWithGenericMethodFromJava() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/useOfInlineClassWithGenericMethodFromJava.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("useThisInsideInlineClass.kt")
|
||||
public void testUseThisInsideInlineClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/useThisInsideInlineClass.kt");
|
||||
|
||||
+5
@@ -542,6 +542,11 @@ public class IrWriteSignatureTestGenerated extends AbstractIrWriteSignatureTest
|
||||
runTest("compiler/testData/writeSignature/inlineClasses/genericInlineClassWithNotNullTypeParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericMethodInsideClass.kt")
|
||||
public void testGenericMethodInsideClass() throws Exception {
|
||||
runTest("compiler/testData/writeSignature/inlineClasses/genericMethodInsideClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassAsGenericArgument.kt")
|
||||
public void testInlineClassAsGenericArgument() throws Exception {
|
||||
runTest("compiler/testData/writeSignature/inlineClasses/inlineClassAsGenericArgument.kt");
|
||||
|
||||
+5
@@ -542,6 +542,11 @@ public class WriteSignatureTestGenerated extends AbstractWriteSignatureTest {
|
||||
runTest("compiler/testData/writeSignature/inlineClasses/genericInlineClassWithNotNullTypeParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericMethodInsideClass.kt")
|
||||
public void testGenericMethodInsideClass() throws Exception {
|
||||
runTest("compiler/testData/writeSignature/inlineClasses/genericMethodInsideClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassAsGenericArgument.kt")
|
||||
public void testInlineClassAsGenericArgument() throws Exception {
|
||||
runTest("compiler/testData/writeSignature/inlineClasses/inlineClassAsGenericArgument.kt");
|
||||
|
||||
Reference in New Issue
Block a user