Files
kotlin/compiler/testData/codegen/boxWithStdlib/reflection/methodsFromAny/memberExtensionToString.kt
Alexander Udalov 8d9618348d Move .java and .kotlin extension properties to kotlin.jvm
Delete the old ones in package kotlin.reflect.jvm because otherwise the code
using those functions will become red in a lot less meaningful way (overload
resolution ambiguity) than if they're deleted (unresolved import)

Based on the work originally done by @dnpetrov

 #KT-8380 Fixed
2015-08-27 08:19:50 +03:00

20 lines
466 B
Kotlin
Vendored

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