Introduce language feature for array literals in annotations
This commit is contained in:
+4
@@ -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() {}
|
||||
|
||||
|
||||
+2
@@ -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])
|
||||
|
||||
+1
@@ -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],
|
||||
|
||||
compiler/testData/codegen/light-analysis/collectionLiterals/collectionLiteralsInArgumentPosition.txt
Vendored
+4
-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[]
|
||||
|
||||
Vendored
+2
-1
@@ -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[]
|
||||
|
||||
Vendored
+1
@@ -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[]
|
||||
|
||||
Reference in New Issue
Block a user