Restore support for local class literals in annotation arguments
This was broken in c1ab08c8ce where we started to represent KClassValue
as a ClassId of the referenced class + number of times it's been wrapped
into kotlin.Array. Local classes do not have a sane ClassId, so in this
change we restore the old behavior by representing KClassValue with a
sealed class value instead
#KT-29891 Fixed
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_REFLECT
|
||||
|
||||
package test
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
annotation class Anno(val k1: KClass<*>, val k2: KClass<*>, val k3: KClass<*>)
|
||||
|
||||
fun box(): String {
|
||||
class L
|
||||
|
||||
@Anno(k1 = L::class, k2 = Array<L?>::class, k3 = Array<out Array<L>>::class)
|
||||
class M
|
||||
|
||||
val fqName = "test.LocalClassLiteralKt\$box\$L"
|
||||
assertEquals(
|
||||
"[@test.Anno(k1=class $fqName, k2=class [L$fqName;, k3=class [[L$fqName;)]",
|
||||
M::class.annotations.toString()
|
||||
)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user