NI: clean calls in coroutine inference before the second analysis of += only for right side

^KT-39660 Fixed
This commit is contained in:
Victor Petukhov
2020-06-18 12:34:52 +03:00
parent 1f66049a1e
commit ece61915de
9 changed files with 58 additions and 1 deletions
@@ -0,0 +1,22 @@
// WITH_RUNTIME
import kotlin.experimental.ExperimentalTypeInference
interface SendChannel<in T> {
suspend fun send(value: T)
}
@OptIn(ExperimentalTypeInference::class)
public fun <T> flux(@BuilderInference block: suspend SendChannel<T>.() -> Unit) {}
suspend inline fun <T> T.collect(action: (T) -> Unit) { action(this) }
fun test() {
flux {
var result = ""
"OK".collect { result += it }
send(result)
}
}
fun box() = "OK"