[LL FIR] add tests for nested class as annotation argument

^KT-62587
This commit is contained in:
Dmitrii Gridin
2023-10-13 19:06:11 +02:00
committed by Space Team
parent 5298d79dec
commit bbd09c6272
32 changed files with 2512 additions and 0 deletions
@@ -1722,6 +1722,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/annotations/blockLevelOnTheSameLineWarning.kt");
}
@Test
@TestMetadata("constantFromOuterScopeAsAnnotaionParameter.kt")
public void testConstantFromOuterScopeAsAnnotaionParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/constantFromOuterScopeAsAnnotaionParameter.kt");
}
@Test
@TestMetadata("ConstructorCall.kt")
public void testConstructorCall() throws Exception {
@@ -1992,12 +1998,30 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.kt");
}
@Test
@TestMetadata("nestedClassAsAnnotationParameter.kt")
public void testNestedClassAsAnnotationParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/nestedClassAsAnnotationParameter.kt");
}
@Test
@TestMetadata("nestedClassAsIsAsAnnotationParameter.kt")
public void testNestedClassAsIsAsAnnotationParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/nestedClassAsIsAsAnnotationParameter.kt");
}
@Test
@TestMetadata("nestedClassesInAnnotations.kt")
public void testNestedClassesInAnnotations() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.kt");
}
@Test
@TestMetadata("nestedObjectAsAnnotationParameter.kt")
public void testNestedObjectAsAnnotationParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/nestedObjectAsAnnotationParameter.kt");
}
@Test
@TestMetadata("noNameProperty.kt")
public void testNoNameProperty() throws Exception {
@@ -2046,6 +2070,18 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/annotations/onMultiDeclaration.kt");
}
@Test
@TestMetadata("qualifiedNestedClassAsAnnotationParameter.kt")
public void testQualifiedNestedClassAsAnnotationParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/qualifiedNestedClassAsAnnotationParameter.kt");
}
@Test
@TestMetadata("qualifiedNestedClassAsIsAsAnnotationParameter.kt")
public void testQualifiedNestedClassAsIsAsAnnotationParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/qualifiedNestedClassAsIsAsAnnotationParameter.kt");
}
@Test
@TestMetadata("RecursivelyAnnotated.kt")
public void testRecursivelyAnnotated() throws Exception {
@@ -2142,6 +2178,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/annotations/typealiasWithAnnotatedAbstractClass.kt");
}
@Test
@TestMetadata("unreachableNestedClassAsAnnotationParameter.kt")
public void testUnreachableNestedClassAsAnnotationParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/unreachableNestedClassAsAnnotationParameter.kt");
}
@Test
@TestMetadata("UnresolvedAnnotationOnObject.kt")
public void testUnresolvedAnnotationOnObject() throws Exception {
@@ -1722,6 +1722,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/annotations/blockLevelOnTheSameLineWarning.kt");
}
@Test
@TestMetadata("constantFromOuterScopeAsAnnotaionParameter.kt")
public void testConstantFromOuterScopeAsAnnotaionParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/constantFromOuterScopeAsAnnotaionParameter.kt");
}
@Test
@TestMetadata("ConstructorCall.kt")
public void testConstructorCall() throws Exception {
@@ -1998,12 +2004,30 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.kt");
}
@Test
@TestMetadata("nestedClassAsAnnotationParameter.kt")
public void testNestedClassAsAnnotationParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/nestedClassAsAnnotationParameter.kt");
}
@Test
@TestMetadata("nestedClassAsIsAsAnnotationParameter.kt")
public void testNestedClassAsIsAsAnnotationParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/nestedClassAsIsAsAnnotationParameter.kt");
}
@Test
@TestMetadata("nestedClassesInAnnotations.kt")
public void testNestedClassesInAnnotations() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.kt");
}
@Test
@TestMetadata("nestedObjectAsAnnotationParameter.kt")
public void testNestedObjectAsAnnotationParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/nestedObjectAsAnnotationParameter.kt");
}
@Test
@TestMetadata("noNameProperty.kt")
public void testNoNameProperty() throws Exception {
@@ -2052,6 +2076,18 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/annotations/onMultiDeclaration.kt");
}
@Test
@TestMetadata("qualifiedNestedClassAsAnnotationParameter.kt")
public void testQualifiedNestedClassAsAnnotationParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/qualifiedNestedClassAsAnnotationParameter.kt");
}
@Test
@TestMetadata("qualifiedNestedClassAsIsAsAnnotationParameter.kt")
public void testQualifiedNestedClassAsIsAsAnnotationParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/qualifiedNestedClassAsIsAsAnnotationParameter.kt");
}
@Test
@TestMetadata("RecursivelyAnnotated.kt")
public void testRecursivelyAnnotated() throws Exception {
@@ -2148,6 +2184,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/annotations/typealiasWithAnnotatedAbstractClass.kt");
}
@Test
@TestMetadata("unreachableNestedClassAsAnnotationParameter.kt")
public void testUnreachableNestedClassAsAnnotationParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/unreachableNestedClassAsAnnotationParameter.kt");
}
@Test
@TestMetadata("UnresolvedAnnotationOnObject.kt")
public void testUnresolvedAnnotationOnObject() throws Exception {
@@ -0,0 +1,11 @@
// FIR_IDENTICAL
annotation class Anno(val number: Int)
class Outer {
companion object {
const val CONSTANT_FROM_COMPANION = 42
@Anno(CONSTANT_FROM_COMPANION)
class Nested
}
}
@@ -0,0 +1,14 @@
// LL_FIR_DIVERGENCE
// KT-62587
// LL_FIR_DIVERGENCE
// FIR_IDENTICAL
annotation class Anno(val number: Int)
class Outer {
companion object {
const val CONSTANT_FROM_COMPANION = 42
@Anno(<!UNRESOLVED_REFERENCE!>CONSTANT_FROM_COMPANION<!>)
class Nested
}
}
@@ -0,0 +1,12 @@
// FIR_IDENTICAL
import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.TYPE)
annotation class Special(val why: KClass<*>)
interface Interface
class Outer {
@Special(Nested::class)
class Nested<@Special(Nested::class) T> : @Special(Nested::class) Interface
}
@@ -0,0 +1,15 @@
// LL_FIR_DIVERGENCE
// KT-62587
// LL_FIR_DIVERGENCE
// FIR_IDENTICAL
import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.TYPE)
annotation class Special(val why: KClass<*>)
interface Interface
class Outer {
@Special(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!><!UNRESOLVED_REFERENCE!>Nested<!>::class<!>)
class Nested<@Special(Nested::class) T> : @Special(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!><!UNRESOLVED_REFERENCE!>Nested<!>::class<!>) Interface
}
@@ -0,0 +1,11 @@
import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.TYPE)
annotation class Special(val why: KClass<*>)
interface Interface
class Outer {
@Special(<!ARGUMENT_TYPE_MISMATCH, NO_COMPANION_OBJECT!>Nested<!>)
class Nested<@Special(<!ARGUMENT_TYPE_MISMATCH, NO_COMPANION_OBJECT!>Nested<!>) T> : @Special(<!ARGUMENT_TYPE_MISMATCH, NO_COMPANION_OBJECT!>Nested<!>) Interface
}
@@ -0,0 +1,11 @@
import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.TYPE)
annotation class Special(val why: KClass<*>)
interface Interface
class Outer {
@Special(<!NO_COMPANION_OBJECT!>Nested<!>)
class Nested<@Special(<!NO_COMPANION_OBJECT!>Nested<!>) T> : @Special(<!NO_COMPANION_OBJECT!>Nested<!>) Interface
}
@@ -0,0 +1,14 @@
// LL_FIR_DIVERGENCE
// KT-62587
// LL_FIR_DIVERGENCE
import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.TYPE)
annotation class Special(val why: KClass<*>)
interface Interface
class Outer {
@Special(<!UNRESOLVED_REFERENCE!>Nested<!>)
class Nested<@Special(<!ARGUMENT_TYPE_MISMATCH, NO_COMPANION_OBJECT!>Nested<!>) T> : @Special(<!UNRESOLVED_REFERENCE!>Nested<!>) Interface
}
@@ -0,0 +1,12 @@
// FIR_IDENTICAL
import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE)
annotation class Special(val why: KClass<*>)
interface Interface
object Outer {
@Special(Nested::class)
object Nested : @Special(Nested::class) Interface
}
@@ -0,0 +1,15 @@
// LL_FIR_DIVERGENCE
// KT-62587
// LL_FIR_DIVERGENCE
// FIR_IDENTICAL
import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE)
annotation class Special(val why: KClass<*>)
interface Interface
object Outer {
@Special(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!><!UNRESOLVED_REFERENCE!>Nested<!>::class<!>)
object Nested : @Special(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!><!UNRESOLVED_REFERENCE!>Nested<!>::class<!>) Interface
}
@@ -0,0 +1,12 @@
// FIR_IDENTICAL
import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.TYPE)
annotation class Special(val why: KClass<*>)
interface Interface
class Outer {
@Special(Outer.Nested::class)
class Nested<@Special(Outer.Nested::class) T> : @Special(Outer.Nested::class) Interface
}
@@ -0,0 +1,11 @@
import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.TYPE)
annotation class Special(val why: KClass<*>)
interface Interface
class Outer {
@Special(<!ARGUMENT_TYPE_MISMATCH!>Outer.<!NO_COMPANION_OBJECT!>Nested<!><!>)
class Nested<@Special(<!ARGUMENT_TYPE_MISMATCH!>Outer.<!NO_COMPANION_OBJECT!>Nested<!><!>) T> : @Special(<!ARGUMENT_TYPE_MISMATCH!>Outer.<!NO_COMPANION_OBJECT!>Nested<!><!>) Interface
}
@@ -0,0 +1,11 @@
import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.TYPE)
annotation class Special(val why: KClass<*>)
interface Interface
class Outer {
@Special(Outer.<!NO_COMPANION_OBJECT!>Nested<!>)
class Nested<@Special(Outer.<!NO_COMPANION_OBJECT!>Nested<!>) T> : @Special(Outer.<!NO_COMPANION_OBJECT!>Nested<!>) Interface
}
@@ -0,0 +1,13 @@
import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.TYPE)
annotation class Special(val why: KClass<*>)
interface Interface
class Outer {
@Special(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!><!UNRESOLVED_REFERENCE!>NestedNested<!>::class<!>)
class Nested<@Special(NestedNested::class) T> : @Special(NestedNested::class) Interface {
class NestedNested
}
}
@@ -0,0 +1,13 @@
import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.TYPE)
annotation class Special(val why: KClass<*>)
interface Interface
class Outer {
@Special(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!><!UNRESOLVED_REFERENCE!>NestedNested<!>::class<!>)
class Nested<@Special(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!><!UNRESOLVED_REFERENCE!>NestedNested<!>::class<!>) T> : @Special(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!><!UNRESOLVED_REFERENCE!>NestedNested<!>::class<!>) Interface {
class NestedNested
}
}
@@ -0,0 +1,16 @@
// LL_FIR_DIVERGENCE
// KT-62587
// LL_FIR_DIVERGENCE
import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.TYPE)
annotation class Special(val why: KClass<*>)
interface Interface
class Outer {
@Special(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!><!UNRESOLVED_REFERENCE!>NestedNested<!>::class<!>)
class Nested<@Special(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!><!UNRESOLVED_REFERENCE!>NestedNested<!>::class<!>) T> : @Special(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!><!UNRESOLVED_REFERENCE!>NestedNested<!>::class<!>) Interface {
class NestedNested
}
}
@@ -1722,6 +1722,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/annotations/blockLevelOnTheSameLineWarning.kt");
}
@Test
@TestMetadata("constantFromOuterScopeAsAnnotaionParameter.kt")
public void testConstantFromOuterScopeAsAnnotaionParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/constantFromOuterScopeAsAnnotaionParameter.kt");
}
@Test
@TestMetadata("ConstructorCall.kt")
public void testConstructorCall() throws Exception {
@@ -1998,12 +2004,30 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/annotations/MutuallyRecursivelyAnnotatedGlobalFunction.kt");
}
@Test
@TestMetadata("nestedClassAsAnnotationParameter.kt")
public void testNestedClassAsAnnotationParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/nestedClassAsAnnotationParameter.kt");
}
@Test
@TestMetadata("nestedClassAsIsAsAnnotationParameter.kt")
public void testNestedClassAsIsAsAnnotationParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/nestedClassAsIsAsAnnotationParameter.kt");
}
@Test
@TestMetadata("nestedClassesInAnnotations.kt")
public void testNestedClassesInAnnotations() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.kt");
}
@Test
@TestMetadata("nestedObjectAsAnnotationParameter.kt")
public void testNestedObjectAsAnnotationParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/nestedObjectAsAnnotationParameter.kt");
}
@Test
@TestMetadata("noNameProperty.kt")
public void testNoNameProperty() throws Exception {
@@ -2052,6 +2076,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/annotations/onMultiDeclaration.kt");
}
@Test
@TestMetadata("qualifiedNestedClassAsAnnotationParameter.kt")
public void testQualifiedNestedClassAsAnnotationParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/qualifiedNestedClassAsAnnotationParameter.kt");
}
@Test
@TestMetadata("qualifiedNestedClassAsIsAsAnnotationParameter.kt")
public void testQualifiedNestedClassAsIsAsAnnotationParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/qualifiedNestedClassAsIsAsAnnotationParameter.kt");
}
@Test
@TestMetadata("RecursivelyAnnotated.kt")
public void testRecursivelyAnnotated() throws Exception {
@@ -2148,6 +2184,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/annotations/typealiasWithAnnotatedAbstractClass.kt");
}
@Test
@TestMetadata("unreachableNestedClassAsAnnotationParameter.kt")
public void testUnreachableNestedClassAsAnnotationParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/unreachableNestedClassAsAnnotationParameter.kt");
}
@Test
@TestMetadata("UnresolvedAnnotationOnObject.kt")
public void testUnresolvedAnnotationOnObject() throws Exception {