JVM_IR add more tests for specialized generics and reification
This commit is contained in:
committed by
teamcityserver
parent
0098103376
commit
a213dad9ab
+12
@@ -22958,6 +22958,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithCharClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("specializedWithReifiedTypeParameter.kt")
|
||||
public void testSpecializedWithReifiedTypeParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithReifiedTypeParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("specializedWithString.kt")
|
||||
public void testSpecializedWithString() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithString.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("voidReturnTypeAsGeneric.kt")
|
||||
public void testVoidReturnTypeAsGeneric() throws Exception {
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// SAM_CONVERSIONS: INDY
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
|
||||
// CHECK_BYTECODE_TEXT
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 java/lang/invoke/LambdaMetafactory
|
||||
|
||||
// FILE: specializedWithReifiedTypeParameter.kt
|
||||
class OK
|
||||
|
||||
inline fun <reified T> f(): T =
|
||||
T::class.java.constructors.first().newInstance() as T
|
||||
|
||||
fun <T> foo2(g: GenericToAny<T>): T = g.invoke()
|
||||
|
||||
fun box(): String {
|
||||
return foo2<OK>(::f)::class.simpleName!!
|
||||
}
|
||||
|
||||
// FILE: GenericToAny.java
|
||||
public interface GenericToAny<T> {
|
||||
T invoke();
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// SAM_CONVERSIONS: INDY
|
||||
|
||||
// CHECK_BYTECODE_TEXT
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 java/lang/invoke/LambdaMetafactory
|
||||
|
||||
fun interface GenericToAny<T> {
|
||||
fun invoke(Inner: T): T
|
||||
}
|
||||
|
||||
fun <T> foo2(t: T, g: GenericToAny<T>): T = g.invoke(t)
|
||||
|
||||
fun box(): String {
|
||||
return foo2("OK") { it }
|
||||
}
|
||||
+12
@@ -22820,6 +22820,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithCharClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("specializedWithReifiedTypeParameter.kt")
|
||||
public void testSpecializedWithReifiedTypeParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithReifiedTypeParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("specializedWithString.kt")
|
||||
public void testSpecializedWithString() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithString.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("voidReturnTypeAsGeneric.kt")
|
||||
public void testVoidReturnTypeAsGeneric() throws Exception {
|
||||
|
||||
+12
@@ -22958,6 +22958,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithCharClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("specializedWithReifiedTypeParameter.kt")
|
||||
public void testSpecializedWithReifiedTypeParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithReifiedTypeParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("specializedWithString.kt")
|
||||
public void testSpecializedWithString() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithString.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("voidReturnTypeAsGeneric.kt")
|
||||
public void testVoidReturnTypeAsGeneric() throws Exception {
|
||||
|
||||
+10
@@ -19122,6 +19122,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithCharClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("specializedWithReifiedTypeParameter.kt")
|
||||
public void testSpecializedWithReifiedTypeParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithReifiedTypeParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("specializedWithString.kt")
|
||||
public void testSpecializedWithString() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/specializedWithString.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("voidReturnTypeAsGeneric.kt")
|
||||
public void testVoidReturnTypeAsGeneric() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/invokedynamic/sam/specializedGenerics/voidReturnTypeAsGeneric.kt");
|
||||
|
||||
Reference in New Issue
Block a user