Minor. Add regression test for KT-60136

Spread operator works incorrectly in K1, but correctly in K2.
 #KT-60136 Fixed
This commit is contained in:
Ilmir Usmanov
2023-09-04 20:18:33 +02:00
committed by Space Team
parent 2d334c4e71
commit 184b5cebe7
8 changed files with 60 additions and 0 deletions
@@ -44212,6 +44212,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/reflection/annotations/simpleValAnnotation.kt");
}
@Test
@TestMetadata("spread.kt")
public void testSpread() throws Exception {
runTest("compiler/testData/codegen/box/reflection/annotations/spread.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/reflection/annotations/onTypes")
@TestDataPath("$PROJECT_ROOT")
@@ -44212,6 +44212,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
runTest("compiler/testData/codegen/box/reflection/annotations/simpleValAnnotation.kt");
}
@Test
@TestMetadata("spread.kt")
public void testSpread() throws Exception {
runTest("compiler/testData/codegen/box/reflection/annotations/spread.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/reflection/annotations/onTypes")
@TestDataPath("$PROJECT_ROOT")
@@ -44212,6 +44212,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/reflection/annotations/simpleValAnnotation.kt");
}
@Test
@TestMetadata("spread.kt")
public void testSpread() throws Exception {
runTest("compiler/testData/codegen/box/reflection/annotations/spread.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/reflection/annotations/onTypes")
@TestDataPath("$PROJECT_ROOT")
@@ -0,0 +1,19 @@
// TARGET_BACKEND: JVM
// WITH_REFLECT
// IGNORE_BACKEND_K1: JVM, JVM_IR
@Retention(AnnotationRetention.RUNTIME)
annotation class A(vararg val xs: String)
@A(*arrayOf("a"), *arrayOf("b"))
fun test() {}
fun box(): String {
val annotation = ::test.annotations.single() as A
if (!annotation.xs.contentEquals(arrayOf("a", "b"))) return annotation.toString()
return "OK"
}
fun main() {
println(box())
}
@@ -41632,6 +41632,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/reflection/annotations/simpleValAnnotation.kt");
}
@Test
@TestMetadata("spread.kt")
public void testSpread() throws Exception {
runTest("compiler/testData/codegen/box/reflection/annotations/spread.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/reflection/annotations/onTypes")
@TestDataPath("$PROJECT_ROOT")
@@ -44212,6 +44212,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/reflection/annotations/simpleValAnnotation.kt");
}
@Test
@TestMetadata("spread.kt")
public void testSpread() throws Exception {
runTest("compiler/testData/codegen/box/reflection/annotations/spread.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/reflection/annotations/onTypes")
@TestDataPath("$PROJECT_ROOT")
@@ -44212,6 +44212,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
runTest("compiler/testData/codegen/box/reflection/annotations/simpleValAnnotation.kt");
}
@Test
@TestMetadata("spread.kt")
public void testSpread() throws Exception {
runTest("compiler/testData/codegen/box/reflection/annotations/spread.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/reflection/annotations/onTypes")
@TestDataPath("$PROJECT_ROOT")
@@ -34930,6 +34930,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Annotations extends AbstractLightAnalysisModeTest {
@TestMetadata("spread.kt")
public void ignoreSpread() throws Exception {
runTest("compiler/testData/codegen/box/reflection/annotations/spread.kt");
}
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
}