JVM add tests for KT-48544 & KT-49226

This commit is contained in:
Dmitry Petrov
2021-10-14 08:49:39 +03:00
committed by TeamCityServer
parent d2e5523180
commit 6ba65065ee
10 changed files with 117 additions and 0 deletions
@@ -2942,6 +2942,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
@TestMetadata("compiler/testData/codegen/box/callableReference/adaptedReferences")
@TestDataPath("$PROJECT_ROOT")
public class AdaptedReferences {
@Test
@TestMetadata("adaptedArrayOf.kt")
public void testAdaptedArrayOf() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/adaptedArrayOf.kt");
}
@Test
@TestMetadata("adaptedVarargFunImportedFromObject.kt")
public void testAdaptedVarargFunImportedFromObject() throws Exception {
@@ -40252,6 +40258,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/sam/kt4753_2.kt");
}
@Test
@TestMetadata("kt49226.kt")
public void testKt49226() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt49226.kt");
}
@Test
@TestMetadata("nonInlinedSamWrapper.kt")
public void testNonInlinedSamWrapper() throws Exception {
@@ -0,0 +1,18 @@
// IGNORE_BACKEND_FIR: JVM_IR
// java.lang.UnsupportedOperationException: This function has a reified type parameter and thus can only be inlined at compilation time,
// not called directly.
// at kotlin.jvm.internal.Intrinsics.throwUndefinedForReified(Intrinsics.java:207)
// at kotlin.jvm.internal.Intrinsics.throwUndefinedForReified(Intrinsics.java:201)
// at kotlin.jvm.internal.Intrinsics.reifiedOperationMarker(Intrinsics.java:211)
// at AdaptedArrayOfKt$box$t$1.invoke(adaptedArrayOf.kt:5)
// at AdaptedArrayOfKt$box$t$1.invoke(adaptedArrayOf.kt:5)
// at AdaptedArrayOfKt.test(adaptedArrayOf.kt:2)
// at AdaptedArrayOfKt.box(adaptedArrayOf.kt:5)
fun test(f: (Int, Int) -> Array<Int>) =
f('O'.toInt(), 'K'.toInt())
fun box(): String {
val t = test(::arrayOf)
return "${t[0].toChar()}${t[1].toChar()}"
}
+33
View File
@@ -0,0 +1,33 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND_FIR: JVM_IR
// java.lang.UnsupportedOperationException: This function has a reified type parameter and thus can only be inlined at compilation time,
// not called directly.
// at kotlin.jvm.internal.Intrinsics.throwUndefinedForReified(Intrinsics.java:207)
// at kotlin.jvm.internal.Intrinsics.throwUndefinedForReified(Intrinsics.java:201)
// at kotlin.jvm.internal.Intrinsics.reifiedOperationMarker(Intrinsics.java:211)
// at Kt49226Kt$box$x$1.invoke(kt49226.kt:5)
// at Kt49226Kt$box$x$1.invoke(kt49226.kt:5)
// at Kt49226Kt$sam$Func$0.apply(kt49226.kt)
// at Mapper.map(Mapper.java:20)
// at Kt49226Kt.box(kt49226.kt:5)
// FILE: kt49226.kt
fun box(): String {
val x: Array<String> = Mapper("OK").map(::arrayOf)
return x[0]
}
// FILE: Func.java
public interface Func <T, R> { R apply(T t); }
// FILE: Mapper.java
public class Mapper<T> {
T t;
public Mapper(T t) {
this.t = t;
}
public <R> R map(Func<T, R> f) {
return f.apply(t);
}
}
@@ -2870,6 +2870,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
@TestMetadata("compiler/testData/codegen/box/callableReference/adaptedReferences")
@TestDataPath("$PROJECT_ROOT")
public class AdaptedReferences {
@Test
@TestMetadata("adaptedArrayOf.kt")
public void testAdaptedArrayOf() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/adaptedArrayOf.kt");
}
@Test
@TestMetadata("adaptedVarargFunImportedFromObject.kt")
public void testAdaptedVarargFunImportedFromObject() throws Exception {
@@ -40090,6 +40096,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/sam/kt4753_2.kt");
}
@Test
@TestMetadata("kt49226.kt")
public void testKt49226() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt49226.kt");
}
@Test
@TestMetadata("nonInlinedSamWrapper.kt")
public void testNonInlinedSamWrapper() throws Exception {
@@ -2942,6 +2942,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
@TestMetadata("compiler/testData/codegen/box/callableReference/adaptedReferences")
@TestDataPath("$PROJECT_ROOT")
public class AdaptedReferences {
@Test
@TestMetadata("adaptedArrayOf.kt")
public void testAdaptedArrayOf() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/adaptedArrayOf.kt");
}
@Test
@TestMetadata("adaptedVarargFunImportedFromObject.kt")
public void testAdaptedVarargFunImportedFromObject() throws Exception {
@@ -40252,6 +40258,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/sam/kt4753_2.kt");
}
@Test
@TestMetadata("kt49226.kt")
public void testKt49226() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt49226.kt");
}
@Test
@TestMetadata("nonInlinedSamWrapper.kt")
public void testNonInlinedSamWrapper() throws Exception {
@@ -2522,6 +2522,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
@TestMetadata("adaptedArrayOf.kt")
public void testAdaptedArrayOf() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/adaptedArrayOf.kt");
}
@TestMetadata("adaptedVarargFunImportedFromObject.kt")
public void testAdaptedVarargFunImportedFromObject() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/adaptedVarargFunImportedFromObject.kt");
@@ -32114,6 +32119,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/sam/kt4753_2.kt");
}
@TestMetadata("kt49226.kt")
public void testKt49226() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt49226.kt");
}
@TestMetadata("nonInlinedSamWrapper.kt")
public void testNonInlinedSamWrapper() throws Exception {
runTest("compiler/testData/codegen/box/sam/nonInlinedSamWrapper.kt");
@@ -1732,6 +1732,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath);
}
@TestMetadata("adaptedArrayOf.kt")
public void testAdaptedArrayOf() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/adaptedArrayOf.kt");
}
@TestMetadata("adaptedVarargFunImportedFromObject.kt")
public void testAdaptedVarargFunImportedFromObject() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/adaptedVarargFunImportedFromObject.kt");
@@ -1732,6 +1732,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
@TestMetadata("adaptedArrayOf.kt")
public void testAdaptedArrayOf() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/adaptedArrayOf.kt");
}
@TestMetadata("adaptedVarargFunImportedFromObject.kt")
public void testAdaptedVarargFunImportedFromObject() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/adaptedVarargFunImportedFromObject.kt");
@@ -1697,6 +1697,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
}
@TestMetadata("adaptedArrayOf.kt")
public void testAdaptedArrayOf() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/adaptedArrayOf.kt");
}
@TestMetadata("adaptedVarargFunImportedFromObject.kt")
public void testAdaptedVarargFunImportedFromObject() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/adaptedVarargFunImportedFromObject.kt");
@@ -1722,6 +1722,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
@TestMetadata("adaptedArrayOf.kt")
public void testAdaptedArrayOf() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/adaptedArrayOf.kt");
}
@TestMetadata("adaptedVarargFunImportedFromObject.kt")
public void testAdaptedVarargFunImportedFromObject() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/adaptedVarargFunImportedFromObject.kt");