[FIR] Report errors on cycles in annotation parameter types

^KT-47932
This commit is contained in:
Dmitriy Novozhilov
2022-01-12 14:34:10 +03:00
committed by teamcity
parent e9ac24dc33
commit 9f870b0549
12 changed files with 109 additions and 32 deletions
@@ -1,15 +0,0 @@
// WITH_REFLECT
// LANGUAGE: +ProhibitCyclesInAnnotations
// ISSUE: KT-47932
import kotlin.reflect.KClass
annotation class X(val value: X) // error
annotation class Y(val value: Array<Y>) // error
annotation class Z1(val a: Z2, val b: Z2) // error
annotation class Z2(val value: Z1) // error
annotation class A(val x: KClass<A>) // OK
annotation class B(val x: KClass<B>) // OK
annotation class C(val b: B) // OK
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// WITH_REFLECT
// LANGUAGE: +ProhibitCyclesInAnnotations
// ISSUE: KT-47932
@@ -1,15 +0,0 @@
// WITH_REFLECT
// LANGUAGE: -ProhibitCyclesInAnnotations
// ISSUE: KT-47932
import kotlin.reflect.KClass
annotation class X(val value: X) // error
annotation class Y(val value: Array<Y>) // error
annotation class Z1(val a: Z2, val b: Z2) // error
annotation class Z2(val value: Z1) // error
annotation class A(val x: KClass<A>) // OK
annotation class B(val x: KClass<B>) // OK
annotation class C(val b: B) // OK
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// WITH_REFLECT
// LANGUAGE: -ProhibitCyclesInAnnotations
// ISSUE: KT-47932
@@ -30,7 +30,7 @@ annotation class C6(val irrelevant: Double, val value: Array<A6> = [])
// Should be an error after fixing KT-47932.
@R(A7::class)
annotation class A7(val value: Array<A7>)
annotation class A7(<!CYCLE_IN_ANNOTATION_PARAMETER_WARNING!>val value: Array<A7><!>)
@@ -30,7 +30,7 @@ annotation class C6(val irrelevant: Double, val value: Array<A6> = [])
// Should be an error after fixing KT-47932.
@R(A7::class)
annotation class A7(val value: Array<A7>)
annotation class A7(<!CYCLE_IN_ANNOTATION_PARAMETER_WARNING!>val value: Array<A7><!>)