[NI] Add test for obsolete issue

#KT-30858 Obsolete
This commit is contained in:
Mikhail Zarechenskiy
2019-04-15 00:12:09 +03:00
parent 9f4db04839
commit e27f71c6f3
6 changed files with 61 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
// !LANGUAGE: +NewInference
// IGNORE_BACKEND: JVM_IR, NATIVE
// WITH_RUNTIME
// WITH_COROUTINES
class MyReceiveChannel<out E>
interface MyProducerScope<in E>
interface MyCoroutineScope
suspend inline fun <E> MyReceiveChannel<E>.myConsumeEach(action: (E) -> Unit) {}
suspend fun myDelay(timeMillis: Long) {}
fun myLaunch(
block: suspend MyCoroutineScope.() -> Unit
) {}
@UseExperimental(kotlin.experimental.ExperimentalTypeInference::class)
public fun <E> myProduce(@BuilderInference block: suspend MyProducerScope<E>.() -> Unit) {}
fun <T> MyReceiveChannel<T>.debounce(period: Long) {
myProduce {
myConsumeEach {
myLaunch {
myDelay(period)
}
}
}
}
fun box(): String {
val m = MyReceiveChannel<String>()
m.debounce(42)
return "OK"
}