5c807266f6
IrDeclarationOrigin.FILE_CLASS is used in CallableReferenceLowering to generate correct declaration owner. Many reflection tests start to fail with this commit because they are now treating callable references to top level declarations as Kotlin symbols and fail because there's no JVM signature for them; this is fixed in subsequent commits (previously, they worked because without Kotlin metadata, these files were treated as Java classes)
31 lines
676 B
Kotlin
Vendored
31 lines
676 B
Kotlin
Vendored
// IGNORE_BACKEND: JVM_IR
|
|
// TARGET_BACKEND: JVM
|
|
// WITH_REFLECT
|
|
package test
|
|
|
|
import kotlin.test.assertEquals
|
|
import kotlin.test.assertTrue
|
|
|
|
annotation class Anno(@get:JvmName("uglyJvmName") val value: String)
|
|
|
|
@Anno(value = "OK")
|
|
class Foo
|
|
|
|
|
|
annotation class Meta(val anno: Anno)
|
|
|
|
@Meta(Anno(value = "OK"))
|
|
fun bar() {}
|
|
|
|
fun box(): String {
|
|
val f = Foo::class.annotations.single()
|
|
assertTrue("@test.Anno\\(uglyJvmName=\"?OK\"?\\)".toRegex().matches(f.toString()))
|
|
assertEquals("OK", (f as Anno).value)
|
|
|
|
val b = ::bar.annotations.single()
|
|
assertEquals("@test.Meta(anno=$f)", b.toString())
|
|
assertEquals("OK", (b as Meta).anno.value)
|
|
|
|
return "OK"
|
|
}
|