FIR: report ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT

This commit is contained in:
Mikhail Glukhikh
2021-05-11 18:05:57 +03:00
parent 55104a594c
commit 1a3aa1bff0
7 changed files with 8 additions and 42 deletions
@@ -1,8 +0,0 @@
annotation class A
annotation class A1(val x: Int)
annotation class B(
val a: A = A(),
val x: Int = A1(42).x,
val aa: Array<A> = arrayOf(A())
)
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
annotation class A
annotation class A1(val x: Int)
@@ -1,22 +0,0 @@
import kotlin.reflect.KClass
const val CONST = 1
fun foo() = 1
val nonConst = foo()
annotation class ValidAnn(
val p1: Int = 1 + CONST,
val p2: String = "",
val p3: KClass<*> = String::class,
val p4: IntArray = intArrayOf(1, 2, 3),
val p5: Array<String> = arrayOf("abc"),
val p6: Array<KClass<*>> = arrayOf(Int::class)
)
val nonConstKClass = String::class
annotation class InvalidAnn(
val p1: Int = foo(),
val p2: Int = nonConst,
val p3: KClass<*> = nonConstKClass
)
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
import kotlin.reflect.KClass
const val CONST = 1