Files
kotlin-fork/backend.native/tests/external/codegen/box/reflection/enclosing/functionExpressionInProperty.kt
T
2017-03-13 15:31:46 +03:00

22 lines
675 B
Kotlin

// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// WITH_REFLECT
val property = fun () {}
fun box(): String {
val javaClass = property.javaClass
val enclosingMethod = javaClass.getEnclosingMethod()
if (enclosingMethod != null) return "method: $enclosingMethod"
val enclosingClass = javaClass.getEnclosingClass()!!.getName()
if (enclosingClass != "FunctionExpressionInPropertyKt") return "enclosing class: $enclosingClass"
val declaringClass = javaClass.getDeclaringClass()
if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass"
return "OK"
}