Files
kotlin/compiler/testData/codegen/boxWithStdlib/reflection/methodsFromAny/memberExtensionToString.kt
Alexander Udalov 8f0885ca03 Rename KClass.properties and extensionProperties: prepend 'member'
To better emphasize the fact that all returned properties require an instance
of the class they are declared in. Another issue was that
'Some::class.extensionProperties' was sometimes incorrectly perceived as
"get all extension properties available on the class Some"
2015-07-29 21:36:47 +03:00

21 lines
499 B
Kotlin
Vendored

import kotlin.reflect.jvm.kotlin
import kotlin.reflect.*
class A {
var String.id: String
get() = this
set(value) {}
fun Int.foo(): Double = toDouble()
}
fun box(): String {
val p = javaClass<A>().kotlin.memberExtensionProperties.single()
return if ("$p" == "var A.(kotlin.String.)id") "OK" else "Fail $p"
val q = javaClass<A>().kotlin.declaredFunctions.single()
if ("$q" != "fun A.(kotlin.Int.)foo(): kotlin.Double") return "Fail q $q"
return "OK"
}