[FIR] add missed tests for declaration annotations

^KT-63832
This commit is contained in:
Dmitrii Gridin
2023-11-27 14:52:04 +01:00
committed by Space Team
parent 001e9a4489
commit aaaf35fcb8
13 changed files with 154 additions and 2 deletions
@@ -1872,6 +1872,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/annotations/cycleInParameters_before.kt");
}
@Test
@TestMetadata("danglingAnnotation.kt")
public void testDanglingAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/danglingAnnotation.kt");
}
@Test
@TestMetadata("DanglingInScript.kts")
public void testDanglingInScript() throws Exception {
@@ -1962,6 +1968,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/annotations/InheritingAnnotationClass.kt");
}
@Test
@TestMetadata("initializerWithNestedAnnotation.kt")
public void testInitializerWithNestedAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/initializerWithNestedAnnotation.kt");
}
@Test
@TestMetadata("invalidTypesInAnnotationConstructor.kt")
public void testInvalidTypesInAnnotationConstructor() throws Exception {
@@ -2034,6 +2046,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.kt");
}
@Test
@TestMetadata("nestedAliasWithNestedAnnotation.kt")
public void testNestedAliasWithNestedAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/nestedAliasWithNestedAnnotation.kt");
}
@Test
@TestMetadata("nestedClassAsAnnotationParameter.kt")
public void testNestedClassAsAnnotationParameter() throws Exception {
@@ -1872,6 +1872,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/annotations/cycleInParameters_before.kt");
}
@Test
@TestMetadata("danglingAnnotation.kt")
public void testDanglingAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/danglingAnnotation.kt");
}
@Test
@TestMetadata("DanglingInScript.kts")
public void testDanglingInScript() throws Exception {
@@ -1962,6 +1968,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/annotations/InheritingAnnotationClass.kt");
}
@Test
@TestMetadata("initializerWithNestedAnnotation.kt")
public void testInitializerWithNestedAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/initializerWithNestedAnnotation.kt");
}
@Test
@TestMetadata("invalidTypesInAnnotationConstructor.kt")
public void testInvalidTypesInAnnotationConstructor() throws Exception {
@@ -2034,6 +2046,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.kt");
}
@Test
@TestMetadata("nestedAliasWithNestedAnnotation.kt")
public void testNestedAliasWithNestedAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/nestedAliasWithNestedAnnotation.kt");
}
@Test
@TestMetadata("nestedClassAsAnnotationParameter.kt")
public void testNestedClassAsAnnotationParameter() throws Exception {
@@ -1872,6 +1872,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/annotations/cycleInParameters_before.kt");
}
@Test
@TestMetadata("danglingAnnotation.kt")
public void testDanglingAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/danglingAnnotation.kt");
}
@Test
@TestMetadata("DanglingMixed.kt")
public void testDanglingMixed() throws Exception {
@@ -1956,6 +1962,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/annotations/InheritingAnnotationClass.kt");
}
@Test
@TestMetadata("initializerWithNestedAnnotation.kt")
public void testInitializerWithNestedAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/initializerWithNestedAnnotation.kt");
}
@Test
@TestMetadata("invalidTypesInAnnotationConstructor.kt")
public void testInvalidTypesInAnnotationConstructor() throws Exception {
@@ -2028,6 +2040,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.kt");
}
@Test
@TestMetadata("nestedAliasWithNestedAnnotation.kt")
public void testNestedAliasWithNestedAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/nestedAliasWithNestedAnnotation.kt");
}
@Test
@TestMetadata("nestedClassAsAnnotationParameter.kt")
public void testNestedClassAsAnnotationParameter() throws Exception {
@@ -1872,6 +1872,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/annotations/cycleInParameters_before.kt");
}
@Test
@TestMetadata("danglingAnnotation.kt")
public void testDanglingAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/danglingAnnotation.kt");
}
@Test
@TestMetadata("DanglingInScript.kts")
public void testDanglingInScript() throws Exception {
@@ -1962,6 +1968,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/annotations/InheritingAnnotationClass.kt");
}
@Test
@TestMetadata("initializerWithNestedAnnotation.kt")
public void testInitializerWithNestedAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/initializerWithNestedAnnotation.kt");
}
@Test
@TestMetadata("invalidTypesInAnnotationConstructor.kt")
public void testInvalidTypesInAnnotationConstructor() throws Exception {
@@ -2034,6 +2046,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.kt");
}
@Test
@TestMetadata("nestedAliasWithNestedAnnotation.kt")
public void testNestedAliasWithNestedAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/nestedAliasWithNestedAnnotation.kt");
}
@Test
@TestMetadata("nestedClassAsAnnotationParameter.kt")
public void testNestedClassAsAnnotationParameter() throws Exception {
@@ -0,0 +1,9 @@
annotation class Anno(val position: String)
interface OriginalInterface {
companion object {
private const val prop = 0
}
@Anno("dangling $<!UNRESOLVED_REFERENCE!>prop<!>")<!SYNTAX!><!>
}
@@ -0,0 +1,9 @@
annotation class Anno(val position: String)
interface OriginalInterface {
companion object {
private const val prop = 0
}
@Anno("dangling $prop")<!SYNTAX!><!>
}
@@ -0,0 +1,11 @@
annotation class Anno(val position: String)
class MyClass {
<!WRONG_ANNOTATION_TARGET!>@Anno("init $<!UNRESOLVED_REFERENCE!>prop<!>")<!> init {
}
companion object {
private const val prop = 0
}
}
@@ -0,0 +1,11 @@
annotation class Anno(val position: String)
class MyClass {
<!WRONG_ANNOTATION_TARGET!>@Anno("init $prop")<!> init {
}
companion object {
private const val prop = 0
}
}
@@ -0,0 +1,11 @@
@Target(AnnotationTarget.TYPE, AnnotationTarget.TYPEALIAS, AnnotationTarget.TYPE_PARAMETER)
annotation class Anno(val position: String)
interface OriginalInterface<T> {
<!TOPLEVEL_TYPEALIASES_ONLY!>@Anno("alias $<!UNRESOLVED_REFERENCE!>prop<!>")
typealias NestedTypeAlias <@Anno("type param $<!UNRESOLVED_REFERENCE!>prop<!>") A : <!BOUND_ON_TYPE_ALIAS_PARAMETER_NOT_ALLOWED!>@Anno("bound $<!UNRESOLVED_REFERENCE!>prop<!>") Number<!>> = @Anno("type $<!UNRESOLVED_REFERENCE!>prop<!>") OriginalInterface<A><!>
companion object {
private const val prop = 0
}
}
@@ -0,0 +1,11 @@
@Target(AnnotationTarget.TYPE, AnnotationTarget.TYPEALIAS, AnnotationTarget.TYPE_PARAMETER)
annotation class Anno(val position: String)
interface OriginalInterface<T> {
<!TOPLEVEL_TYPEALIASES_ONLY!>@Anno("alias $prop")
typealias NestedTypeAlias <@Anno("type param $prop") A : <!BOUND_ON_TYPE_ALIAS_PARAMETER_NOT_ALLOWED!>@Anno("bound $prop") Number<!>> = @Anno("type $prop") OriginalInterface<A><!>
companion object {
private const val prop = 0
}
}
@@ -7,7 +7,7 @@ annotation class Anno(val position: String)
interface OriginalInterface {
@Anno("explicitType $prop")
fun <@Anno("type param $prop") F : @Anno("bound $prop") List<@Anno("nested bound $prop") List<@Anno("nested nested bound $prop") String>>> @receiver:Anno("receiver annotation: $prop") @Anno("receiver type $prop") Collection<@Anno("nested receiver type $prop") List<@Anno("nested nested receiver type $prop")String>>.explicitType(@Anno("parameter annotation $prop") param: @Anno("parameter type $prop") ListIterator<@Anno("nested parameter type $prop") List<@Anno("nested nested parameter type $prop")String>>): @Anno("explicitType return type $prop") List<@Anno("explicitType nested return type $prop") List<@Anno("explicitType nested nested return type $prop") Int>> = emptyList()
val <@Anno("type param $prop") F : @Anno("bound $prop") Number> F.explicitType: @Anno("bound $prop") Int get() = 1
val <@Anno("type param $prop") F : @Anno("bound $prop") Number> @receiver:Anno("receiver annotation: $<!UNRESOLVED_REFERENCE!>prop<!>") @Anno("receiver type $<!UNRESOLVED_REFERENCE!>prop<!>") F.explicitType: @Anno("bound $prop") Int get() = 1
companion object {
private const val prop = 0
@@ -7,7 +7,7 @@ annotation class Anno(val position: String)
interface OriginalInterface {
@Anno("explicitType $prop")
fun <@Anno("type param $prop") F : @Anno("bound $prop") List<@Anno("nested bound $prop") List<@Anno("nested nested bound $prop") String>>> @receiver:Anno("receiver annotation: $prop") <!REPEATED_ANNOTATION!>@Anno("receiver type $prop")<!> Collection<@Anno("nested receiver type $prop") List<@Anno("nested nested receiver type $prop")String>>.explicitType(@Anno("parameter annotation $prop") param: @Anno("parameter type $prop") ListIterator<@Anno("nested parameter type $prop") List<@Anno("nested nested parameter type $prop")String>>): @Anno("explicitType return type $prop") List<@Anno("explicitType nested return type $prop") List<@Anno("explicitType nested nested return type $prop") Int>> = emptyList()
val <@Anno("type param $prop") F : @Anno("bound $prop") Number> F.explicitType: @Anno("bound $prop") Int get() = 1
val <@Anno("type param $prop") F : @Anno("bound $prop") Number> @receiver:Anno("receiver annotation: $prop") <!REPEATED_ANNOTATION!>@Anno("receiver type $prop")<!> F.explicitType: @Anno("bound $prop") Int get() = 1
companion object {
private const val prop = 0
@@ -1872,6 +1872,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/annotations/cycleInParameters_before.kt");
}
@Test
@TestMetadata("danglingAnnotation.kt")
public void testDanglingAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/danglingAnnotation.kt");
}
@Test
@TestMetadata("DanglingInScript.kts")
public void testDanglingInScript() throws Exception {
@@ -1962,6 +1968,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/annotations/InheritingAnnotationClass.kt");
}
@Test
@TestMetadata("initializerWithNestedAnnotation.kt")
public void testInitializerWithNestedAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/initializerWithNestedAnnotation.kt");
}
@Test
@TestMetadata("invalidTypesInAnnotationConstructor.kt")
public void testInvalidTypesInAnnotationConstructor() throws Exception {
@@ -2034,6 +2046,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.kt");
}
@Test
@TestMetadata("nestedAliasWithNestedAnnotation.kt")
public void testNestedAliasWithNestedAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/nestedAliasWithNestedAnnotation.kt");
}
@Test
@TestMetadata("nestedClassAsAnnotationParameter.kt")
public void testNestedClassAsAnnotationParameter() throws Exception {