Files
kotlin-fork/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.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

29 lines
760 B
Kotlin
Vendored

annotation class Foo(val a: IntArray, val b: Array<String>, val c: FloatArray)
@Foo([1], ["/"], [1f])
fun test1() {}
@Foo([], [], [])
fun test2() {}
@Foo([<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1f<!>], <!TYPE_MISMATCH!>[' ']<!>, [<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>])
fun test3() {}
@Foo(c = [1f], b = [""], a = [1])
fun test4() {}
@Foo([1 + 2], ["Hello, " + "Kotlin"], [<!DIVISION_BY_ZERO!>1 / 0f<!>])
fun test5() {}
const val ONE = 1
val two = 2
@Foo([ONE], [], [])
fun test6() {}
@Foo(<!NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION!>[<!NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION!>ONE + two<!>]<!>, [], [])
fun test7() {}
@Foo(<!NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION!>[<!NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION!>two<!>]<!>, [], [])
fun test8() {}