Initialize builder inference lambda anyway, even a call is inapplicable
^KT-47744 Fixed
This commit is contained in:
committed by
teamcityserver
parent
2b0ba6fa40
commit
357fda2efa
@@ -0,0 +1,38 @@
|
||||
// !LANGUAGE: +UnrestrictedBuilderInference
|
||||
// WITH_RUNTIME
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <T> flow(@BuilderInference block: suspend FlowCollector<T>.() -> Unit) = Flow<T>()
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <E> produce(@BuilderInference block: suspend SendChannel<E>.() -> Unit) {}
|
||||
|
||||
interface SendChannel<in E> {
|
||||
val onSend: SelectClause2<E, SendChannel<E>>
|
||||
}
|
||||
|
||||
interface SelectClause2<in P, out Q>
|
||||
class Flow<out T>
|
||||
interface FlowCollector<in T>
|
||||
|
||||
interface SelectBuilder<in R> {
|
||||
operator fun <P, Q> SelectClause2<P, Q>.invoke(param: P, block: suspend (Q) -> R)
|
||||
}
|
||||
|
||||
inline fun <R> select(crossinline builder: SelectBuilder<R>.() -> Unit) = Unit as R
|
||||
|
||||
fun box(): String {
|
||||
val x: Flow<String> = flow {
|
||||
produce {
|
||||
select<Unit> {
|
||||
onSend("") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user