K2: fix field annotation splitting and frontend checks

Related to KT-57135
This commit is contained in:
Mikhail Glukhikh
2023-03-22 16:13:51 +01:00
committed by Space Team
parent 37ed7beda0
commit dc38ce24f7
43 changed files with 497 additions and 119 deletions
@@ -0,0 +1,34 @@
FILE: FieldAnnotationWithClasses.kt
public final annotation class Ann : R|kotlin/Annotation| {
public constructor(vararg allowedTypes: R|kotlin/Array<out kotlin/reflect/KClass<*>>|): R|Ann| {
super<R|kotlin/Any|>()
}
public final val allowedTypes: R|kotlin/Array<out kotlin/reflect/KClass<*>>| = R|<local>/allowedTypes|
public get(): R|kotlin/Array<out kotlin/reflect/KClass<*>>|
}
public final fun foo(): R|kotlin/Unit| {
local final class Local : R|kotlin/Any| {
public constructor(): R|Local| {
super<R|kotlin/Any|>()
}
field:@FIELD:R|Ann|(allowedTypes = vararg(allowedTypes = <implicitArrayOf>(<getClass>(Q|Some|), <getClass>(Q|Other|)))) public final val x: R|kotlin/Int| = Int(42)
public get(): R|kotlin/Int|
}
}
public final class Some : R|kotlin/Any| {
public constructor(): R|Some| {
super<R|kotlin/Any|>()
}
}
public final class Other : R|kotlin/Any| {
public constructor(): R|Other| {
super<R|kotlin/Any|>()
}
}
@@ -0,0 +1,15 @@
// WITH_REFLECT
import kotlin.reflect.*
annotation class Ann(vararg val allowedTypes: KClass<*>)
fun foo() {
class Local {
@field:Ann(allowedTypes = [Some::class, Other::class])
val x: Int = 42
}
}
class Some
class Other