Add one more test on delegated properties to check NI

This commit is contained in:
Mikhail Zarechenskiy
2018-03-26 14:37:32 +03:00
parent 3ea0b9975f
commit b8c0910724
4 changed files with 56 additions and 0 deletions
@@ -0,0 +1,22 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_PARAMETER
import kotlin.reflect.KProperty
fun test(i: Int) {
val bad by myLazyDelegate {
createSample(i) { it.toString() }
}
takeSample(bad)
}
fun <T> myLazyDelegate(i: () -> T): LazyDelegate<T> = LazyDelegate(i())
class LazyDelegate<T>(val v: T) {
operator fun getValue(thisRef: Any?, property: KProperty<*>): T = TODO()
}
class Sample<K, V>
fun takeSample(g: Sample<Int, String>) {}
fun <T, S> createSample(i: T, a: (T) -> S): Sample<T, S> = TODO()