[JVM IR] Add tests to verify correct parameter reflection metadata for
suspend functions.
This commit is contained in:
committed by
Ilmir Usmanov
parent
06408011f0
commit
8cdef13537
@@ -0,0 +1,25 @@
|
|||||||
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
|
// SKIP_JDK6
|
||||||
|
// TARGET_BACKEND: JVM
|
||||||
|
// WITH_RUNTIME
|
||||||
|
// FULL_JDK
|
||||||
|
// KOTLIN_CONFIGURATION_FLAGS: +JVM.PARAMETERS_METADATA
|
||||||
|
// COMMON_COROUTINES_TEST
|
||||||
|
import COROUTINES_PACKAGE.*
|
||||||
|
import COROUTINES_PACKAGE.intrinsics.*
|
||||||
|
|
||||||
|
class A() {
|
||||||
|
suspend fun test(OK: String) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val clazz = A::class.java
|
||||||
|
val method = clazz.getDeclaredMethod("test", String::class.java, Continuation::class.java)
|
||||||
|
val parameters = method.getParameters()
|
||||||
|
|
||||||
|
if (parameters[0].modifiers != 0) return "wrong modifier on value parameter: ${parameters[0].modifiers}"
|
||||||
|
if (parameters[1].modifiers != 0) return "wrong modifier on Continuation parameter: ${parameters[1].modifiers}"
|
||||||
|
return parameters[0].name
|
||||||
|
}
|
||||||
+14
@@ -18560,6 +18560,10 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception {
|
||||||
|
KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
public void testAllFilesPresentInParametersMetadata() throws Exception {
|
public void testAllFilesPresentInParametersMetadata() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||||
}
|
}
|
||||||
@@ -18608,6 +18612,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
public void testSuperParams() throws Exception {
|
public void testSuperParams() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/parametersMetadata/superParams.kt");
|
runTest("compiler/testData/codegen/box/parametersMetadata/superParams.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("suspendFunction.kt")
|
||||||
|
public void testSuspendFunction_1_2() throws Exception {
|
||||||
|
runTestWithPackageReplacement("compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt", "kotlin.coroutines.experimental");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("suspendFunction.kt")
|
||||||
|
public void testSuspendFunction_1_3() throws Exception {
|
||||||
|
runTestWithPackageReplacement("compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt", "kotlin.coroutines");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/platformTypes")
|
@TestMetadata("compiler/testData/codegen/box/platformTypes")
|
||||||
|
|||||||
+19
-5
@@ -14693,6 +14693,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
public static class NotNullAssertions extends AbstractLightAnalysisModeTest {
|
public static class NotNullAssertions extends AbstractLightAnalysisModeTest {
|
||||||
|
@TestMetadata("paramAssertionMessage.kt")
|
||||||
|
public void ignoreParamAssertionMessage() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/paramAssertionMessage.kt");
|
||||||
|
}
|
||||||
|
|
||||||
private void runTest(String testDataFilePath) throws Exception {
|
private void runTest(String testDataFilePath) throws Exception {
|
||||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||||
}
|
}
|
||||||
@@ -14776,11 +14781,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullableTypeParameter.kt");
|
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullableTypeParameter.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("paramAssertionMessage.kt")
|
|
||||||
public void testParamAssertionMessage() throws Exception {
|
|
||||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/paramAssertionMessage.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("staticCallErrorMessage.kt")
|
@TestMetadata("staticCallErrorMessage.kt")
|
||||||
public void testStaticCallErrorMessage() throws Exception {
|
public void testStaticCallErrorMessage() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/staticCallErrorMessage.kt");
|
runTest("compiler/testData/codegen/box/javaInterop/notNullAssertions/staticCallErrorMessage.kt");
|
||||||
@@ -18560,6 +18560,10 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception {
|
||||||
|
KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM, testDataFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
public void testAllFilesPresentInParametersMetadata() throws Exception {
|
public void testAllFilesPresentInParametersMetadata() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||||
}
|
}
|
||||||
@@ -18608,6 +18612,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
public void testSuperParams() throws Exception {
|
public void testSuperParams() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/parametersMetadata/superParams.kt");
|
runTest("compiler/testData/codegen/box/parametersMetadata/superParams.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("suspendFunction.kt")
|
||||||
|
public void testSuspendFunction_1_2() throws Exception {
|
||||||
|
runTestWithPackageReplacement("compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt", "kotlin.coroutines.experimental");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("suspendFunction.kt")
|
||||||
|
public void testSuspendFunction_1_3() throws Exception {
|
||||||
|
runTestWithPackageReplacement("compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt", "kotlin.coroutines");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/platformTypes")
|
@TestMetadata("compiler/testData/codegen/box/platformTypes")
|
||||||
|
|||||||
+9
@@ -17069,6 +17069,10 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
|
KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception {
|
||||||
|
KotlinTestUtils.runTestWithCustomIgnoreDirective(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
|
||||||
|
}
|
||||||
|
|
||||||
public void testAllFilesPresentInParametersMetadata() throws Exception {
|
public void testAllFilesPresentInParametersMetadata() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||||
}
|
}
|
||||||
@@ -17117,6 +17121,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
public void testSuperParams() throws Exception {
|
public void testSuperParams() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/parametersMetadata/superParams.kt");
|
runTest("compiler/testData/codegen/box/parametersMetadata/superParams.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("suspendFunction.kt")
|
||||||
|
public void testSuspendFunction_1_3() throws Exception {
|
||||||
|
runTestWithPackageReplacement("compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt", "kotlin.coroutines");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/platformTypes")
|
@TestMetadata("compiler/testData/codegen/box/platformTypes")
|
||||||
|
|||||||
+9
@@ -17069,6 +17069,10 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception {
|
||||||
|
KotlinTestUtils.runTest(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JVM_IR, testDataFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
public void testAllFilesPresentInParametersMetadata() throws Exception {
|
public void testAllFilesPresentInParametersMetadata() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||||
}
|
}
|
||||||
@@ -17117,6 +17121,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
public void testSuperParams() throws Exception {
|
public void testSuperParams() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/parametersMetadata/superParams.kt");
|
runTest("compiler/testData/codegen/box/parametersMetadata/superParams.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("suspendFunction.kt")
|
||||||
|
public void testSuspendFunction_1_3() throws Exception {
|
||||||
|
runTestWithPackageReplacement("compiler/testData/codegen/box/parametersMetadata/suspendFunction.kt", "kotlin.coroutines");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/platformTypes")
|
@TestMetadata("compiler/testData/codegen/box/platformTypes")
|
||||||
|
|||||||
Generated
+4
@@ -14295,6 +14295,10 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception {
|
||||||
|
KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS_IR, testDataFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
public void testAllFilesPresentInParametersMetadata() throws Exception {
|
public void testAllFilesPresentInParametersMetadata() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
@@ -14400,6 +14400,10 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
|
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void runTestWithPackageReplacement(String testDataFilePath, String packageName) throws Exception {
|
||||||
|
KotlinTestUtils.runTest0(filePath -> doTestWithCoroutinesPackageReplacement(filePath, packageName), TargetBackend.JS, testDataFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
public void testAllFilesPresentInParametersMetadata() throws Exception {
|
public void testAllFilesPresentInParametersMetadata() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/parametersMetadata"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user