Files
kotlin-fork/compiler/testData/codegen/box/sealed/constructorAnnotations.kt
T
2021-01-25 17:29:38 +03:00

24 lines
709 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// WITH_REFLECT
annotation class Ann
sealed class Test @Ann constructor(@Ann val x: String)
fun box(): String {
val testCtor = Test::class.constructors.single()
val testCtorAnnClasses = testCtor.annotations.map { it.annotationClass }
if (testCtorAnnClasses != listOf(Ann::class)) {
throw AssertionError("Annotations on constructor: $testCtorAnnClasses")
}
for (param in testCtor.parameters) {
val paramAnnClasses = param.annotations.map { it.annotationClass }
if (paramAnnClasses != listOf(Ann::class)) {
throw AssertionError("Annotations on constructor parameter $param: $paramAnnClasses")
}
}
return "OK"
}