8f0885ca03
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"
24 lines
603 B
Kotlin
Vendored
24 lines
603 B
Kotlin
Vendored
import kotlin.reflect.*
|
|
import kotlin.test.*
|
|
|
|
open class Super {
|
|
val a: Int = 1
|
|
val String.b: String get() = this
|
|
}
|
|
|
|
class Sub : Super() {
|
|
val c: Double = 1.0
|
|
val Char.d: Char get() = this
|
|
}
|
|
|
|
fun box(): String {
|
|
val sub = Sub::class
|
|
|
|
assertEquals(listOf("a", "c"), sub.memberProperties.map { it.name }.sort())
|
|
assertEquals(listOf("b", "d"), sub.memberExtensionProperties.map { it.name }.sort())
|
|
assertEquals(listOf("c"), sub.declaredMemberProperties.map { it.name })
|
|
assertEquals(listOf("d"), sub.declaredMemberExtensionProperties.map { it.name })
|
|
|
|
return "OK"
|
|
}
|