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
+37
@@ -0,0 +1,37 @@
|
||||
// !LANGUAGE: -UnrestrictedBuilderInference
|
||||
// !DIAGNOSTICS: -EXPERIMENTAL_IS_NOT_ENABLED -UNCHECKED_CAST
|
||||
// WITH_RUNTIME
|
||||
|
||||
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 test() {
|
||||
val x: Flow<String> = flow {
|
||||
produce {
|
||||
select<Unit> {
|
||||
onSend("") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// !LANGUAGE: -UnrestrictedBuilderInference
|
||||
// !DIAGNOSTICS: -EXPERIMENTAL_IS_NOT_ENABLED -UNCHECKED_CAST
|
||||
// WITH_RUNTIME
|
||||
|
||||
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 test() {
|
||||
val x: Flow<String> = flow {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>produce<!> {
|
||||
select<Unit> {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>onSend<!>("") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package
|
||||
|
||||
@kotlin.OptIn(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ T> flow(/*0*/ @kotlin.BuilderInference block: suspend FlowCollector<T>.() -> kotlin.Unit): Flow<T>
|
||||
@kotlin.OptIn(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ E> produce(/*0*/ @kotlin.BuilderInference block: suspend SendChannel<E>.() -> kotlin.Unit): kotlin.Unit
|
||||
public inline fun </*0*/ R> select(/*0*/ crossinline builder: SelectBuilder<R>.() -> kotlin.Unit): R
|
||||
public fun test(): kotlin.Unit
|
||||
|
||||
public final class Flow</*0*/ out T> {
|
||||
public constructor Flow</*0*/ out T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface FlowCollector</*0*/ in T> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface SelectBuilder</*0*/ in R> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
public abstract operator fun </*0*/ P, /*1*/ Q> SelectClause2<P, Q>.invoke(/*0*/ param: P, /*1*/ block: suspend (Q) -> R): kotlin.Unit
|
||||
}
|
||||
|
||||
public interface SelectClause2</*0*/ in P, /*1*/ out Q> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface SendChannel</*0*/ in E> {
|
||||
public abstract val onSend: SelectClause2<E, SendChannel<E>>
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user