Files
kotlin-fork/compiler/testData/codegen/boxInline/anonymousObject/kt19434.kt
T
2019-09-06 09:19:57 +03:00

26 lines
659 B
Kotlin
Vendored

// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM
// FILE: 1.kt
//WITH_RUNTIME
package test
annotation class MethodAnnotation
inline fun reproduceIssue(crossinline s: () -> String): String {
val obj = object {
@MethodAnnotation fun annotatedMethod(): String {
return s()
}
}
val annotatedMethod = obj::class.java.declaredMethods.first { it.name == "annotatedMethod" }
if (annotatedMethod.annotations.isEmpty()) return "fail: can't find annotated method"
return obj.annotatedMethod()
}
// FILE: 2.kt
import test.*
fun box(): String {
return reproduceIssue { "OK" }
}