Files
kotlin-fork/compiler/testData/codegen/boxWithStdlib/reflection/properties/allVsDeclared.kt
T
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

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