mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-10 15:53:46 +00:00
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"
21 lines
499 B
Kotlin
Vendored
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"
|
|
}
|