Files
kotlin-fork/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesWithConstantsInAnnotation.kt
T
Dmitriy Novozhilov c1575edca4 [FE 1.0] Drop ArrayLiteralsInAnnotations feature
This feature was introduced in 1.2, so now it's stable part of language
  and we can drop support of disabling it
2022-01-14 14:26:50 +03:00

24 lines
741 B
Kotlin
Vendored

const val ONE = 1
annotation class Foo(
val a: IntArray = [ONE],
val b: IntArray = [ONE, 2, 3]
)
val TWO = 2
fun getOne() = ONE
fun getTwo() = TWO
annotation class Bar(
val a: IntArray = <!ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT!>[TWO]<!>,
val b: IntArray = <!ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT!>[1, TWO]<!>,
val c: IntArray = <!ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT!>[getOne(), getTwo()]<!>
)
annotation class Baz(
val a: IntArray = [<!NULL_FOR_NONNULL_TYPE!>null<!>],
val b: IntArray = [1, <!NULL_FOR_NONNULL_TYPE!>null<!>, 2],
val c: IntArray = <!ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT!>[<!NO_THIS!>this<!>]<!>
)