// WITH_STDLIB // SKIP_TXT // !DIAGNOSTICS: -CAST_NEVER_SUCCEEDS -UNCHECKED_CAST -UNUSED_PARAMETER -UNUSED_VARIABLE -OPT_IN_USAGE_ERROR -UNUSED_EXPRESSION import kotlin.experimental.ExperimentalTypeInference fun FlowCollector.bar(): K = null as K fun FlowCollector.foo(): K = null as K fun K.bar3(): K = null as K fun K.foo3(): K = null as K fun bar2(): Int = 1 fun foo2(): Float = 1f val bar4: Int get() = 1 var foo4: Float get() = 1f set(value) {} val FlowCollector.bar5: K get() = null as K val FlowCollector.foo5: K get() = null as K class Foo6 class Foo7 fun foo7() = null as Foo7 interface FlowCollector {} @OptIn(ExperimentalTypeInference::class) fun flow(block: suspend FlowCollector.() -> Unit) = Flow(block) class Flow(private val block: suspend FlowCollector.() -> Unit) fun poll71(): Flow { return flow { val inv = ::bar2!! inv() } } fun poll73(): Flow { return flow { val inv = ::bar4!! inv } } fun poll75(): Flow { return flow { val inv = ::Foo6!! inv } } fun poll85(): Flow { return flow { val inv = ::Foo6 in setOf(::Foo6) inv } } fun box() = "OK"