Add various test for DeprecatedSinceKotlin annotation

This commit is contained in:
Mikhail Zarechenskiy
2020-06-17 19:37:44 +03:00
parent 0f2c96c64d
commit 2f55a3fa0d
14 changed files with 125 additions and 0 deletions
@@ -6662,6 +6662,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinDeclaration.kt");
}
@TestMetadata("deprecatedSinceKotlinWithoutArguments.kt")
public void testDeprecatedSinceKotlinWithoutArguments() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinWithoutArguments.kt");
}
@TestMetadata("error.kt")
public void testError() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/error.kt");
@@ -6672,6 +6677,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.kt");
}
@TestMetadata("messageFromDeprecatedAnnotation.kt")
public void testMessageFromDeprecatedAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/messageFromDeprecatedAnnotation.kt");
}
@TestMetadata("warning.kt")
public void testWarning() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/warning.kt");
@@ -0,0 +1,9 @@
// FIR_IDENTICAL
@Deprecated("")
@DeprecatedSinceKotlin
fun foo() {}
fun test() {
foo()
}
@@ -0,0 +1,4 @@
package
@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin public fun foo(): kotlin.Unit
public fun test(): kotlin.Unit
@@ -0,0 +1,7 @@
@Deprecated("foo test")
@DeprecatedSinceKotlin(warningSince = "1.0")
fun foo() {}
fun test() {
foo()
}
@@ -0,0 +1,7 @@
@Deprecated("foo test")
@DeprecatedSinceKotlin(warningSince = "1.0")
fun foo() {}
fun test() {
<!DEPRECATION("foo(): Unit", "foo test")!>foo<!>()
}
@@ -0,0 +1,4 @@
package
@kotlin.Deprecated(message = "foo test") @kotlin.DeprecatedSinceKotlin(warningSince = "1.0") public fun foo(): kotlin.Unit
public fun test(): kotlin.Unit
@@ -0,0 +1,23 @@
@Deprecated("")
@DeprecatedSinceKotlin(warningSince = "1.0")
fun test1() {}
@Deprecated("")
@DeprecatedSinceKotlin(warningSince = "1.9")
fun test2() {}
@Deprecated("")
@DeprecatedSinceKotlin
fun test3() {}
// TESTED_OBJECT_KIND: function
// TESTED_OBJECTS: DeprecatedSinceKotlinKt, test1
// FLAGS: ACC_DEPRECATED, ACC_PUBLIC, ACC_FINAL, ACC_STATIC
// TESTED_OBJECT_KIND: function
// TESTED_OBJECTS: DeprecatedSinceKotlinKt, test2
// FLAGS: ACC_DEPRECATED, ACC_PUBLIC, ACC_FINAL, ACC_STATIC
// TESTED_OBJECT_KIND: function
// TESTED_OBJECTS: DeprecatedSinceKotlinKt, test3
// FLAGS: ACC_DEPRECATED, ACC_PUBLIC, ACC_FINAL, ACC_STATIC
@@ -6669,6 +6669,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinDeclaration.kt");
}
@TestMetadata("deprecatedSinceKotlinWithoutArguments.kt")
public void testDeprecatedSinceKotlinWithoutArguments() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinWithoutArguments.kt");
}
@TestMetadata("error.kt")
public void testError() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/error.kt");
@@ -6679,6 +6684,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.kt");
}
@TestMetadata("messageFromDeprecatedAnnotation.kt")
public void testMessageFromDeprecatedAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/messageFromDeprecatedAnnotation.kt");
}
@TestMetadata("warning.kt")
public void testWarning() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/warning.kt");
@@ -6664,6 +6664,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinDeclaration.kt");
}
@TestMetadata("deprecatedSinceKotlinWithoutArguments.kt")
public void testDeprecatedSinceKotlinWithoutArguments() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinWithoutArguments.kt");
}
@TestMetadata("error.kt")
public void testError() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/error.kt");
@@ -6674,6 +6679,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.kt");
}
@TestMetadata("messageFromDeprecatedAnnotation.kt")
public void testMessageFromDeprecatedAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/messageFromDeprecatedAnnotation.kt");
}
@TestMetadata("warning.kt")
public void testWarning() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/warning.kt");
@@ -515,6 +515,11 @@ public class WriteFlagsTestGenerated extends AbstractWriteFlagsTest {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/writeFlags/function/deprecatedFlag"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("deprecatedSinceKotlin.kt")
public void testDeprecatedSinceKotlin() throws Exception {
runTest("compiler/testData/writeFlags/function/deprecatedFlag/deprecatedSinceKotlin.kt");
}
@TestMetadata("emptyGetter.kt")
public void testEmptyGetter() throws Exception {
runTest("compiler/testData/writeFlags/function/deprecatedFlag/emptyGetter.kt");
@@ -515,6 +515,11 @@ public class IrWriteFlagsTestGenerated extends AbstractIrWriteFlagsTest {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/writeFlags/function/deprecatedFlag"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("deprecatedSinceKotlin.kt")
public void testDeprecatedSinceKotlin() throws Exception {
runTest("compiler/testData/writeFlags/function/deprecatedFlag/deprecatedSinceKotlin.kt");
}
@TestMetadata("emptyGetter.kt")
public void testEmptyGetter() throws Exception {
runTest("compiler/testData/writeFlags/function/deprecatedFlag/emptyGetter.kt");
@@ -0,0 +1,13 @@
// "Replace with 'newFun()'" "true"
@Deprecated("", ReplaceWith("newFun()"))
@DeprecatedSinceKotlin(warningSince = "1.0")
fun oldFun() {
newFun()
}
fun newFun() {}
fun foo() {
<caret>oldFun()
}
@@ -0,0 +1,13 @@
// "Replace with 'newFun()'" "true"
@Deprecated("", ReplaceWith("newFun()"))
@DeprecatedSinceKotlin(warningSince = "1.0")
fun oldFun() {
newFun()
}
fun newFun() {}
fun foo() {
<caret>newFun()
}
@@ -6220,6 +6220,11 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
runTest("idea/testData/quickfix/deprecatedSymbolUsage/classLiteralAndTypeArgsRuntime.kt");
}
@TestMetadata("deprecatedSinceKotlinAndReplaceWith.kt")
public void testDeprecatedSinceKotlinAndReplaceWith() throws Exception {
runTest("idea/testData/quickfix/deprecatedSymbolUsage/deprecatedSinceKotlinAndReplaceWith.kt");
}
@TestMetadata("deprecationLevel.kt")
public void testDeprecationLevel() throws Exception {
runTest("idea/testData/quickfix/deprecatedSymbolUsage/deprecationLevel.kt");