Introduce language feature for array literals in annotations

This commit is contained in:
Mikhail Zarechenskiy
2017-03-21 02:49:03 +03:00
parent 0f1acab40d
commit bfe2ddf7c1
15 changed files with 79 additions and 4 deletions
@@ -15,14 +15,18 @@ fun check(b: Boolean, message: String) {
if (!b) throw RuntimeException(message)
}
@Suppress("UNSUPPORTED_FEATURE")
annotation class Foo(val a: FloatArray = [], val b: Array<String> = [], val c: Array<KClass<*>> = [])
@Suppress("UNSUPPORTED_FEATURE")
@Foo(a = [1f, 2f, 1 / 0f])
fun test1() {}
@Suppress("UNSUPPORTED_FEATURE")
@Foo(b = ["Hello", ", ", "Kot" + "lin"])
fun test2() {}
@Suppress("UNSUPPORTED_FEATURE")
@Foo(c = [Int::class, Array<Short>::class, Foo::class])
fun test3() {}
@@ -14,6 +14,7 @@ fun check(b: Boolean, message: String) {
if (!b) throw RuntimeException(message)
}
@Suppress("UNSUPPORTED_FEATURE")
annotation class Foo(val a: IntArray = [], val b: Array<String> = [])
const val ONE_INT = 1
@@ -21,6 +22,7 @@ const val ONE_FLOAT = 1f
const val HELLO = "hello"
const val C_CHAR = 'c'
@Suppress("UNSUPPORTED_FEATURE")
@Foo(
a = [ONE_INT, ONE_INT + ONE_FLOAT.toInt(), ONE_INT + 10, (ONE_INT % 1.0).toInt()],
b = [HELLO, HELLO + C_CHAR, HELLO + ", Kotlin", C_CHAR.toString() + C_CHAR])
@@ -15,6 +15,7 @@ fun check(b: Boolean, message: String) {
if (!b) throw RuntimeException(message)
}
@Suppress("UNSUPPORTED_FEATURE")
annotation class Foo(
val a: IntArray = [],
val b: IntArray = [1, 2, 3],
@@ -3,13 +3,14 @@ public final class CollectionLiteralsInArgumentPositionKt {
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static method check(p0: boolean, @org.jetbrains.annotations.NotNull p1: java.lang.String): void
private final static method test(p0: kotlin.reflect.KFunction, p1: kotlin.jvm.functions.Function1): void
public final static @Foo method test1(): void
public final static @Foo method test2(): void
public final static @Foo method test3(): void
public final static @Foo @kotlin.Suppress method test1(): void
public final static @Foo @kotlin.Suppress method test2(): void
public final static @Foo @kotlin.Suppress method test3(): void
}
@java.lang.annotation.Retention
@kotlin.Metadata
@kotlin.Suppress
public annotation class Foo {
public abstract method a(): float[]
public abstract method b(): java.lang.String[]
@@ -7,11 +7,12 @@ public final class CollectionLiteralsWithConstantsKt {
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static method check(p0: boolean, @org.jetbrains.annotations.NotNull p1: java.lang.String): void
private final static method test(p0: kotlin.reflect.KFunction, p1: kotlin.jvm.functions.Function1): void
public final static @Foo method test1(): void
public final static @Foo @kotlin.Suppress method test1(): void
}
@java.lang.annotation.Retention
@kotlin.Metadata
@kotlin.Suppress
public annotation class Foo {
public abstract method a(): int[]
public abstract method b(): java.lang.String[]
@@ -8,6 +8,7 @@ public final class DefaultAnnotationParameterValuesKt {
@java.lang.annotation.Retention
@kotlin.Metadata
@kotlin.Suppress
public annotation class Foo {
public abstract method a(): int[]
public abstract method b(): int[]