Files
kotlin-fork/compiler/testData/codegen/boxInline/anonymousObject/kt19434.kt
T

24 lines
594 B
Kotlin
Vendored

// 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" }
}