Cleanup deprecated symbol usages in testData
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ import kotlin.test.assertEquals
|
||||
var state: String = ""
|
||||
|
||||
var String.prop: String
|
||||
get() = length().toString()
|
||||
get() = length.toString()
|
||||
set(value) { state = this + value }
|
||||
|
||||
fun box(): String {
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@ import kotlin.test.assertEquals
|
||||
|
||||
class C(var state: String) {
|
||||
var String.prop: String
|
||||
get() = length().toString()
|
||||
get() = length.toString()
|
||||
set(value) { state = this + value }
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import kotlin.reflect.jvm.*
|
||||
class K(private val value: String)
|
||||
|
||||
fun box(): String {
|
||||
val p = javaClass<K>().kotlin.memberProperties.single() as KProperty1<K, String>
|
||||
val p = K::class.java.kotlin.memberProperties.single() as KProperty1<K, String>
|
||||
|
||||
try {
|
||||
return p.get(K("Fail: private property should not be accessible by default"))
|
||||
|
||||
+2
-2
@@ -6,10 +6,10 @@ open class Super(val r: String)
|
||||
class Sub(r: String) : Super(r)
|
||||
|
||||
fun box(): String {
|
||||
val props = javaClass<Sub>().kotlin.declaredMemberProperties
|
||||
val props = Sub::class.java.kotlin.declaredMemberProperties
|
||||
if (!props.isEmpty()) return "Fail $props"
|
||||
|
||||
val allProps = javaClass<Sub>().kotlin.memberProperties
|
||||
val allProps = Sub::class.java.kotlin.memberProperties
|
||||
assertEquals(listOf("r"), allProps.map { it.name })
|
||||
return allProps.single().get(Sub("OK")) as String
|
||||
}
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ class A {
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val props = javaClass<A>().kotlin.memberExtensionProperties
|
||||
val props = A::class.java.kotlin.memberExtensionProperties
|
||||
val readonly = props.single { it.name == "readonly" }
|
||||
assert(readonly !is KMutableProperty2<A, *, *>) { "Fail 1: $readonly" }
|
||||
val mutable = props.single { it.name == "mutable" }
|
||||
|
||||
Vendored
+1
-1
@@ -5,7 +5,7 @@ class A(val readonly: String) {
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val props = javaClass<A>().kotlin.memberProperties
|
||||
val props = A::class.java.kotlin.memberProperties
|
||||
val readonly = props.single { it.name == "readonly" }
|
||||
assert(readonly !is KMutableProperty1<A, *>) { "Fail 1: $readonly" }
|
||||
val mutable = props.single { it.name == "mutable" }
|
||||
|
||||
+2
-2
@@ -7,13 +7,13 @@ class A {
|
||||
|
||||
fun box(): String {
|
||||
run {
|
||||
val foo: KProperty1<A, *> = javaClass<A>().kotlin.memberProperties.single()
|
||||
val foo: KProperty1<A, *> = A::class.java.kotlin.memberProperties.single()
|
||||
assert(foo.name == "foo") { "Fail name: $foo (${foo.name})" }
|
||||
assert(foo.get(A()) == "member") { "Fail value: ${foo.get(A())}" }
|
||||
}
|
||||
|
||||
run {
|
||||
val foo: KProperty2<A, *, *> = javaClass<A>().kotlin.memberExtensionProperties.single()
|
||||
val foo: KProperty2<A, *, *> = A::class.java.kotlin.memberExtensionProperties.single()
|
||||
assert(foo.name == "foo") { "Fail name: $foo (${foo.name})" }
|
||||
foo as KProperty2<A, Unit, *>
|
||||
assert(foo.get(A(), Unit) == "extension") { "Fail value: ${foo.get(A(), Unit)}" }
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ class A(param: String) {
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val klass = javaClass<A>().kotlin
|
||||
val klass = A::class.java.kotlin
|
||||
|
||||
val props = klass.memberProperties
|
||||
|
||||
|
||||
Reference in New Issue
Block a user