Fix Delegates.lazy usages in testData

This commit is contained in:
Ilya Gorbunov
2015-11-03 23:18:58 +03:00
parent 70fdc379ef
commit 850c1518c8
4 changed files with 14 additions and 11 deletions
@@ -28,7 +28,9 @@ class Test<T>(val constructorProperty: T) {
val classField4 : Zin<TParam>? = null
val delegates : Z<TParam>? by Delegates.lazy {Z<TParam>()}
val delegateLazy: Z<TParam>? by lazy {Z<TParam>()}
val delegateNotNull: Z<TParam>? by Delegates.notNull()
}
@@ -65,11 +67,16 @@ fun box(): String {
if (classField4.getGenericType().toString() != "Zin<? super TParam>")
return "fail4:" + classField4.getGenericType();
val classField5 = clz.getDeclaredField("delegates\$delegate");
val classField5 = clz.getDeclaredField("delegateLazy\$delegate");
if (classField5.getGenericType().toString() != "kotlin.properties.ReadOnlyProperty<? super java.lang.Object, ? extends Z<TParam>>")
if (classField5.getGenericType().toString() != "kotlin.Lazy<? extends Z<TParam>>")
return "fail5:" + classField5.getGenericType();
val classField6 = clz.getDeclaredField("delegateNotNull\$delegate");
if (classField6.getGenericType().toString() != "kotlin.properties.ReadWriteProperty<? super java.lang.Object, Z<TParam>>")
return "fail6:" + classField6.getGenericType();
return "OK"
}
@@ -1,11 +1,10 @@
import kotlin.properties.Delegates
import java.util.HashMap
interface R {
fun result(): String
}
val a by Delegates.lazy {
val a by lazy {
with(HashMap<String, R>()) {
put("result", object : R {
override fun result(): String = "OK"
@@ -1,9 +1,8 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
import kotlin.properties.Delegates
class A(val n: Int) {
val <caret>foo: Boolean by Delegates.lazy { n > 1 }
val <caret>foo: Boolean by lazy { n > 1 }
}
fun test() {
@@ -1,5 +1,3 @@
import kotlin.properties.Delegates
val x: Int <caret>by lazy {1}
val x: Int <caret>by Delegates.lazy {1}
// REF: (in kotlin.properties.ReadOnlyProperty).getValue(R,kotlin.reflect.KProperty<*>)
// REF: (for kotlin.Lazy<T> in kotlin).getValue(kotlin.Any?,kotlin.reflect.KProperty<*>)