[NI] Reanalyze coroutine-block if there is inapplicable call
It's not clear how one should rollback _all_ resolution results if there is inapplicable call. Ideally, such calls should not be available in coroutine block but for now, to have backward compatibility, we'll just reanalyze coroutine block as a usual lambda if there is at least one such call. As a result, also remove diagnostic about non-applicable call as it become useless with current reanalysis #KT-37061 Fixed #KT-32097 Fixed #KT-32203 Fixed #KT-35306 Fixed #KT-36202 Fixed #KT-36220 Fixed #KT-32654 Fixed
This commit is contained in:
+20
-4
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.resolve.deprecation.DeprecationResolver
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.expressions.DoubleColonExpressionResolver
|
||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingServices
|
||||
import org.jetbrains.kotlin.types.typeUtil.contains
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.cast
|
||||
|
||||
class CoroutineInferenceSession(
|
||||
@@ -52,6 +53,7 @@ class CoroutineInferenceSession(
|
||||
) {
|
||||
private val commonCalls = arrayListOf<PSICompletedCallInfo>()
|
||||
private val diagnostics = arrayListOf<KotlinCallDiagnostic>()
|
||||
private var hasInapplicableCall = false
|
||||
|
||||
override fun shouldRunCompletion(candidate: KotlinResolutionCandidate): Boolean {
|
||||
val system = candidate.getSystem() as NewConstraintSystemImpl
|
||||
@@ -78,26 +80,40 @@ class CoroutineInferenceSession(
|
||||
|
||||
commonCalls.add(callInfo)
|
||||
|
||||
val resultingDescriptor = callInfo.resolvedCall.resultingDescriptor
|
||||
|
||||
// This check is similar to one for old inference, see getCoroutineInferenceData() function
|
||||
val checkCall = resultingDescriptor is LocalVariableDescriptor || anyReceiverContainStubType(resultingDescriptor)
|
||||
|
||||
if (!checkCall) return
|
||||
|
||||
val isApplicableCall =
|
||||
callComponents.statelessCallbacks.isApplicableCallForBuilderInference(
|
||||
callInfo.resolvedCall.resultingDescriptor,
|
||||
resultingDescriptor,
|
||||
callComponents.languageVersionSettings
|
||||
)
|
||||
|
||||
if (!isApplicableCall) {
|
||||
diagnostics.add(NonApplicableCallForBuilderInferenceDiagnostic(callInfo.callResolutionResult.resultCallAtom.atom))
|
||||
hasInapplicableCall = true
|
||||
}
|
||||
}
|
||||
|
||||
private fun anyReceiverContainStubType(descriptor: CallableDescriptor): Boolean {
|
||||
return descriptor.dispatchReceiverParameter?.type?.contains { it is StubType } == true ||
|
||||
descriptor.extensionReceiverParameter?.type?.contains { it is StubType } == true
|
||||
}
|
||||
|
||||
fun hasInapplicableCall(): Boolean = hasInapplicableCall
|
||||
|
||||
override fun writeOnlyStubs(callInfo: SingleCallResolutionResult): Boolean {
|
||||
return !skipCall(callInfo)
|
||||
}
|
||||
|
||||
private fun skipCall(callInfo: SingleCallResolutionResult): Boolean {
|
||||
// FakeCallableDescriptorForObject and LocalVariableDescriptor can't introduce new information for inference,
|
||||
// FakeCallableDescriptorForObject can't introduce new information for inference,
|
||||
// so it's safe to complete it fully
|
||||
val descriptor = callInfo.resultCallAtom.candidateDescriptor
|
||||
return descriptor is FakeCallableDescriptorForObject || descriptor is LocalVariableDescriptor
|
||||
return descriptor is FakeCallableDescriptorForObject
|
||||
}
|
||||
|
||||
override fun currentConstraintSystem(): ConstraintStorage {
|
||||
|
||||
+16
-4
@@ -139,8 +139,6 @@ class KotlinResolutionCallbacksImpl(
|
||||
if (expectedReturnType == null) ContextDependency.DEPENDENT else ContextDependency.INDEPENDENT
|
||||
)
|
||||
|
||||
trace.record(BindingContext.NEW_INFERENCE_LAMBDA_INFO, psiCallArgument.ktFunction, lambdaInfo)
|
||||
|
||||
val builtIns = outerCallContext.scope.ownerDescriptor.builtIns
|
||||
|
||||
// We have to refine receiverType because resolve inside lambda needs proper scope from receiver,
|
||||
@@ -179,8 +177,16 @@ class KotlinResolutionCallbacksImpl(
|
||||
null
|
||||
}
|
||||
|
||||
|
||||
val temporaryTrace = if (coroutineSession != null)
|
||||
TemporaryBindingTrace.create(trace, "Trace to resolve coroutine $lambdaArgument")
|
||||
else
|
||||
null
|
||||
|
||||
(temporaryTrace ?: trace).record(BindingContext.NEW_INFERENCE_LAMBDA_INFO, psiCallArgument.ktFunction, lambdaInfo)
|
||||
|
||||
val actualContext = outerCallContext
|
||||
.replaceBindingTrace(trace)
|
||||
.replaceBindingTrace(temporaryTrace ?: trace)
|
||||
.replaceContextDependency(lambdaInfo.contextDependency)
|
||||
.replaceExpectedType(approximatesExpectedType)
|
||||
.replaceDataFlowInfo(psiCallArgument.dataFlowInfoBeforeThisArgument).let {
|
||||
@@ -188,7 +194,13 @@ class KotlinResolutionCallbacksImpl(
|
||||
}
|
||||
|
||||
val functionTypeInfo = expressionTypingServices.getTypeInfo(psiCallArgument.expression, actualContext)
|
||||
trace.record(BindingContext.NEW_INFERENCE_LAMBDA_INFO, psiCallArgument.ktFunction, LambdaInfo.STUB_EMPTY)
|
||||
(temporaryTrace ?: trace).record(BindingContext.NEW_INFERENCE_LAMBDA_INFO, psiCallArgument.ktFunction, LambdaInfo.STUB_EMPTY)
|
||||
|
||||
if (coroutineSession?.hasInapplicableCall() == true) {
|
||||
return ReturnArgumentsAnalysisResult(ReturnArgumentsInfo.empty, coroutineSession, hasInapplicableCallForBuilderInference = true)
|
||||
} else {
|
||||
temporaryTrace?.commit()
|
||||
}
|
||||
|
||||
var hasReturnWithoutExpression = false
|
||||
var returnArgumentFound = false
|
||||
|
||||
+7
-2
@@ -50,11 +50,16 @@ data class ReturnArgumentsInfo(
|
||||
val lastExpression: KotlinCallArgument?,
|
||||
val lastExpressionCoercedToUnit: Boolean,
|
||||
val returnArgumentsExist: Boolean
|
||||
)
|
||||
) {
|
||||
companion object {
|
||||
val empty = ReturnArgumentsInfo(emptyList(), null, lastExpressionCoercedToUnit = false, returnArgumentsExist = false)
|
||||
}
|
||||
}
|
||||
|
||||
data class ReturnArgumentsAnalysisResult(
|
||||
val returnArgumentsInfo: ReturnArgumentsInfo,
|
||||
val inferenceSession: InferenceSession?
|
||||
val inferenceSession: InferenceSession?,
|
||||
val hasInapplicableCallForBuilderInference: Boolean = false
|
||||
)
|
||||
|
||||
// This components hold state (trace). Work with this carefully.
|
||||
|
||||
+15
-9
@@ -120,15 +120,21 @@ class PostponedArgumentsAnalyzer(
|
||||
else FilteredAnnotations(annotations, true) { it != KotlinBuiltIns.FQ_NAMES.extensionFunctionType }
|
||||
}
|
||||
|
||||
val (returnArgumentsInfo, inferenceSession) = resolutionCallbacks.analyzeAndGetLambdaReturnArguments(
|
||||
lambda.atom,
|
||||
lambda.isSuspend,
|
||||
receiver,
|
||||
parameters,
|
||||
expectedTypeForReturnArguments,
|
||||
convertedAnnotations ?: Annotations.EMPTY,
|
||||
stubsForPostponedVariables.cast()
|
||||
)
|
||||
val (returnArgumentsInfo, inferenceSession, hasInapplicableCallForBuilderInference) =
|
||||
resolutionCallbacks.analyzeAndGetLambdaReturnArguments(
|
||||
lambda.atom,
|
||||
lambda.isSuspend,
|
||||
receiver,
|
||||
parameters,
|
||||
expectedTypeForReturnArguments,
|
||||
convertedAnnotations ?: Annotations.EMPTY,
|
||||
stubsForPostponedVariables.cast()
|
||||
)
|
||||
|
||||
if (hasInapplicableCallForBuilderInference) {
|
||||
c.getBuilder().removePostponedVariables()
|
||||
return
|
||||
}
|
||||
|
||||
val returnArguments = returnArgumentsInfo.nonErrorArguments
|
||||
returnArguments.forEach { c.addSubsystemFromArgument(it) }
|
||||
|
||||
+4
-5
@@ -1,7 +1,6 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
@file:OptIn(ExperimentalTypeInference::class)
|
||||
|
||||
@@ -26,12 +25,12 @@ val test2 = generate {
|
||||
notYield(3)
|
||||
}
|
||||
|
||||
val test3 = <!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>generate<!> {
|
||||
val test3 = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>generate<!> {
|
||||
yield(3)
|
||||
<!NI;NON_APPLICABLE_CALL_FOR_BUILDER_INFERENCE!>yieldBarReturnType(3)<!>
|
||||
yieldBarReturnType(3)
|
||||
}
|
||||
|
||||
val test4 = <!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>generate<!> {
|
||||
val test4 = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>generate<!> {
|
||||
yield(3)
|
||||
<!NI;NON_APPLICABLE_CALL_FOR_BUILDER_INFERENCE!>barReturnType()<!>
|
||||
barReturnType()
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
package
|
||||
|
||||
public val test1: kotlin.collections.List<kotlin.Int>
|
||||
public val test2: kotlin.collections.List<kotlin.Int>
|
||||
public val test3: kotlin.collections.List<kotlin.Int>
|
||||
public val test4: kotlin.collections.List<kotlin.Int>
|
||||
public fun </*0*/ S> generate(/*0*/ @kotlin.BuilderInference g: suspend GenericController<S>.() -> kotlin.Unit): kotlin.collections.List<S>
|
||||
|
||||
public final class GenericController</*0*/ T> {
|
||||
public constructor GenericController</*0*/ T>()
|
||||
public final fun barReturnType(): 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 final fun notYield(/*0*/ t: T): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
public final suspend fun yield(/*0*/ t: T): kotlin.Unit
|
||||
public final suspend fun yieldBarReturnType(/*0*/ t: T): T
|
||||
}
|
||||
compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferCoroutineTypeInOldVersion.kt
Vendored
+2
-3
@@ -1,7 +1,6 @@
|
||||
// !LANGUAGE: -ExperimentalBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
class Builder<T> {
|
||||
suspend fun add(t: T) {}
|
||||
@@ -22,8 +21,8 @@ val memberWithoutAnn = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_
|
||||
<!ILLEGAL_SUSPEND_FUNCTION_CALL!>add<!>(42)
|
||||
}
|
||||
|
||||
val extension = <!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> {
|
||||
<!NI;NON_APPLICABLE_CALL_FOR_BUILDER_INFERENCE!>extensionAdd("foo")<!>
|
||||
val extension = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> {
|
||||
extensionAdd("foo")
|
||||
}
|
||||
|
||||
val safeExtension = build {
|
||||
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
package
|
||||
|
||||
public val extension: kotlin.collections.List<kotlin.String>
|
||||
public val member: kotlin.collections.List<kotlin.Int>
|
||||
public val memberWithoutAnn: [ERROR : Type for wrongBuild {
|
||||
add(42)
|
||||
}]
|
||||
public val safeExtension: kotlin.collections.List<kotlin.String>
|
||||
public fun </*0*/ S> build(/*0*/ g: suspend Builder<S>.() -> kotlin.Unit): kotlin.collections.List<S>
|
||||
public fun </*0*/ S> wrongBuild(/*0*/ g: Builder<S>.() -> kotlin.Unit): kotlin.collections.List<S>
|
||||
public fun </*0*/ S> Builder<S>.extensionAdd(/*0*/ s: S): kotlin.Unit
|
||||
public suspend fun </*0*/ S> Builder<S>.safeExtensionAdd(/*0*/ s: S): kotlin.Unit
|
||||
|
||||
public final class Builder</*0*/ T> {
|
||||
public constructor Builder</*0*/ T>()
|
||||
public final suspend fun add(/*0*/ t: T): kotlin.Unit
|
||||
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
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
fun aFlow(): Flow<Unit> = channelFlow {
|
||||
awaitClose {
|
||||
}
|
||||
}
|
||||
|
||||
interface Flow<out T> {
|
||||
suspend fun collect(collector: FlowCollector<T>)
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <T> channelFlow(@BuilderInference block: suspend ProducerScope<T>.() -> Unit): Flow<T> = TODO()
|
||||
|
||||
interface ProducerScope<in E>
|
||||
|
||||
interface FlowCollector<in T> {
|
||||
suspend fun emit(value: T)
|
||||
}
|
||||
|
||||
suspend fun ProducerScope<*>.awaitClose(block: () -> Unit = {}) {}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package
|
||||
|
||||
public fun aFlow(): Flow<kotlin.Unit>
|
||||
@kotlin.OptIn(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ T> channelFlow(/*0*/ @kotlin.BuilderInference block: suspend ProducerScope<T>.() -> kotlin.Unit): Flow<T>
|
||||
public suspend fun ProducerScope<*>.awaitClose(/*0*/ block: () -> kotlin.Unit = ...): kotlin.Unit
|
||||
|
||||
public interface Flow</*0*/ out T> {
|
||||
public abstract suspend fun collect(/*0*/ collector: FlowCollector<T>): kotlin.Unit
|
||||
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 abstract suspend fun emit(/*0*/ value: T): kotlin.Unit
|
||||
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 ProducerScope</*0*/ in 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
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
class Buildee<T>
|
||||
class Builder<T>
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
inline fun <T> builder(@BuilderInference block: Builder<T>.() -> Unit): Buildee<T> = TODO()
|
||||
|
||||
private fun <T> Builder<T>.consumer(builder: Builder<T>): Unit = TODO()
|
||||
|
||||
fun <T> Builder<T>.foo(): Buildee<T> = builder {
|
||||
consumer(this)
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package
|
||||
|
||||
@kotlin.OptIn(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public inline fun </*0*/ T> builder(/*0*/ @kotlin.BuilderInference block: Builder<T>.() -> kotlin.Unit): Buildee<T>
|
||||
private fun </*0*/ T> Builder<T>.consumer(/*0*/ builder: Builder<T>): kotlin.Unit
|
||||
public fun </*0*/ T> Builder<T>.foo(): Buildee<T>
|
||||
|
||||
public final class Buildee</*0*/ T> {
|
||||
public constructor Buildee</*0*/ 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 final class Builder</*0*/ T> {
|
||||
public constructor Builder</*0*/ 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
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
interface Build<T>
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <T> build(@BuilderInference fn: Builder<T>.() -> Unit): Build<T> = TODO()
|
||||
|
||||
// Works completely
|
||||
val build = build {
|
||||
value(1)
|
||||
}
|
||||
|
||||
// Works completely
|
||||
val buildWithWrappedValue = build {
|
||||
wrappedValue(Wrapped(1))
|
||||
}
|
||||
|
||||
// Works completely
|
||||
val buildWithFn = build {
|
||||
valueFn {
|
||||
1
|
||||
}
|
||||
}
|
||||
|
||||
// Works, but the ide complains with "Non-applicable call for builder inference"
|
||||
val buildWithFnWrapped = build {
|
||||
wrappedValueFn {
|
||||
Wrapped(1)
|
||||
}
|
||||
}
|
||||
|
||||
interface Builder<T> {
|
||||
fun value(value: T)
|
||||
fun wrappedValue(value: Wrapped<T>)
|
||||
fun wrappedValueFn(fn: () -> Wrapped<T>)
|
||||
fun valueFn(fn: () -> T)
|
||||
}
|
||||
|
||||
data class Wrapped<T>(val value: T)
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package
|
||||
|
||||
public val build: Build<kotlin.Int>
|
||||
public val buildWithFn: Build<kotlin.Int>
|
||||
public val buildWithFnWrapped: Build<kotlin.Int>
|
||||
public val buildWithWrappedValue: Build<kotlin.Int>
|
||||
@kotlin.OptIn(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ T> build(/*0*/ @kotlin.BuilderInference fn: Builder<T>.() -> kotlin.Unit): Build<T>
|
||||
|
||||
public interface Build</*0*/ 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 Builder</*0*/ 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 abstract fun value(/*0*/ value: T): kotlin.Unit
|
||||
public abstract fun valueFn(/*0*/ fn: () -> T): kotlin.Unit
|
||||
public abstract fun wrappedValue(/*0*/ value: Wrapped<T>): kotlin.Unit
|
||||
public abstract fun wrappedValueFn(/*0*/ fn: () -> Wrapped<T>): kotlin.Unit
|
||||
}
|
||||
|
||||
public final data class Wrapped</*0*/ T> {
|
||||
public constructor Wrapped</*0*/ T>(/*0*/ value: T)
|
||||
public final val value: T
|
||||
public final operator /*synthesized*/ fun component1(): T
|
||||
public final /*synthesized*/ fun copy(/*0*/ value: T = ...): Wrapped<T>
|
||||
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
interface Build<T>
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <T> build(@BuilderInference fn: Builder<T>.() -> Unit): Build<T> = TODO()
|
||||
|
||||
interface Builder<T> {
|
||||
fun foo(fn: () -> T)
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val bar = build {
|
||||
foo { listOf(1, 2, 3).firstOrNull() }
|
||||
}
|
||||
val baz = build {
|
||||
foo { listOf(1, 2, 3).firstOrNull() ?: 0 }
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package
|
||||
|
||||
@kotlin.OptIn(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ T> build(/*0*/ @kotlin.BuilderInference fn: Builder<T>.() -> kotlin.Unit): Build<T>
|
||||
public fun main(): kotlin.Unit
|
||||
|
||||
public interface Build</*0*/ 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 Builder</*0*/ T> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun foo(/*0*/ fn: () -> T): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
class TypeDefinition<KotlinType : Any> {
|
||||
fun parse(parser: (serializedValue: String) -> KotlinType?): Unit = TODO()
|
||||
fun serialize(parser: (value: KotlinType) -> Any?): Unit = TODO()
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <KotlinType : Any> defineType(@BuilderInference definition: TypeDefinition<KotlinType>.() -> Unit): Unit = TODO()
|
||||
|
||||
fun main() {
|
||||
<!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>defineType<!> {
|
||||
parse { it.toInt() }
|
||||
serialize { <!OI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>it<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>toString<!>() }
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package
|
||||
|
||||
@kotlin.OptIn(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ KotlinType : kotlin.Any> defineType(/*0*/ @kotlin.BuilderInference definition: TypeDefinition<KotlinType>.() -> kotlin.Unit): kotlin.Unit
|
||||
public fun main(): kotlin.Unit
|
||||
|
||||
public final class TypeDefinition</*0*/ KotlinType : kotlin.Any> {
|
||||
public constructor TypeDefinition</*0*/ KotlinType : kotlin.Any>()
|
||||
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 final fun parse(/*0*/ parser: (serializedValue: kotlin.String) -> KotlinType?): kotlin.Unit
|
||||
public final fun serialize(/*0*/ parser: (value: KotlinType) -> kotlin.Any?): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
// FILE: annotation.kt
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
package kotlin
|
||||
|
||||
@@ -29,8 +28,8 @@ val memberWithoutAnn = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_
|
||||
add(42)
|
||||
}
|
||||
|
||||
val extension = <!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> {
|
||||
<!NI;NON_APPLICABLE_CALL_FOR_BUILDER_INFERENCE!>extensionAdd("foo")<!>
|
||||
val extension = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> {
|
||||
extensionAdd("foo")
|
||||
}
|
||||
|
||||
val safeExtension = build {
|
||||
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
package
|
||||
|
||||
public val extension: kotlin.collections.List<kotlin.String>
|
||||
public val member: kotlin.collections.List<kotlin.Int>
|
||||
public val memberWithoutAnn: [ERROR : Type for wrongBuild {
|
||||
add(42)
|
||||
}]
|
||||
public val safeExtension: kotlin.collections.List<kotlin.String>
|
||||
public fun </*0*/ S> build(/*0*/ @kotlin.BuilderInference g: Builder<S>.() -> kotlin.Unit): kotlin.collections.List<S>
|
||||
public fun </*0*/ S> wrongBuild(/*0*/ g: Builder<S>.() -> kotlin.Unit): kotlin.collections.List<S>
|
||||
public fun </*0*/ S> Builder<S>.extensionAdd(/*0*/ s: S): kotlin.Unit
|
||||
@kotlin.BuilderInference public fun </*0*/ S> Builder<S>.safeExtensionAdd(/*0*/ s: S): kotlin.Unit
|
||||
|
||||
public final class Builder</*0*/ T> {
|
||||
public constructor Builder</*0*/ T>()
|
||||
public final fun add(/*0*/ t: T): kotlin.Unit
|
||||
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
|
||||
}
|
||||
|
||||
package kotlin {
|
||||
|
||||
public final annotation class BuilderInference : kotlin.Annotation {
|
||||
public constructor BuilderInference()
|
||||
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
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -1,6 +1,5 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
// FILE: annotation.kt
|
||||
|
||||
@@ -25,8 +24,8 @@ val normal = generate {
|
||||
yield(42)
|
||||
}
|
||||
|
||||
val extension = <!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>generate<!> {
|
||||
<!NI;NON_APPLICABLE_CALL_FOR_BUILDER_INFERENCE!>extensionYield("foo")<!>
|
||||
val extension = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>generate<!> {
|
||||
extensionYield("foo")
|
||||
}
|
||||
|
||||
val safeExtension = generate {
|
||||
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package
|
||||
|
||||
public val extension: kotlin.collections.List<kotlin.String>
|
||||
public val normal: kotlin.collections.List<kotlin.Int>
|
||||
public val safeExtension: kotlin.collections.List<kotlin.String>
|
||||
public fun </*0*/ S> generate(/*0*/ @kotlin.BuilderInference g: suspend GenericController<S>.() -> kotlin.Unit): kotlin.collections.List<S>
|
||||
public suspend fun </*0*/ S> GenericController<S>.extensionYield(/*0*/ s: S): kotlin.Unit
|
||||
@kotlin.BuilderInference public suspend fun </*0*/ S> GenericController<S>.safeExtensionYield(/*0*/ s: S): kotlin.Unit
|
||||
|
||||
public final class GenericController</*0*/ T> {
|
||||
public constructor GenericController</*0*/ 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 final suspend fun yield(/*0*/ t: T): kotlin.Unit
|
||||
}
|
||||
|
||||
package kotlin {
|
||||
|
||||
public final annotation class BuilderInference : kotlin.Annotation {
|
||||
public constructor BuilderInference()
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,71 @@
|
||||
FILE fqName:<root> fileName:/castsInsideCoroutineInference.kt
|
||||
FUN name:scopedFlow visibility:public modality:FINAL <R> (block:kotlin.Function2<<root>.CoroutineScope, <root>.FlowCollector<R of <root>.scopedFlow>, kotlin.Unit>) returnType:<root>.Flow<R of <root>.scopedFlow>
|
||||
TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:block index:0 type:kotlin.Function2<<root>.CoroutineScope, <root>.FlowCollector<R of <root>.scopedFlow>, kotlin.Unit>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun scopedFlow <R> (block: kotlin.Function2<<root>.CoroutineScope, <root>.FlowCollector<R of <root>.scopedFlow>, kotlin.Unit>): <root>.Flow<R of <root>.scopedFlow> declared in <root>'
|
||||
CALL 'public final fun flow <T> (block: kotlin.Function1<<root>.FlowCollector<T of <root>.flow>, kotlin.Unit>): <root>.Flow<T of <root>.flow> declared in <root>' type=<root>.Flow<R of <root>.scopedFlow> origin=null
|
||||
<T>: R of <root>.scopedFlow
|
||||
block: FUN_EXPR type=kotlin.Function1<<root>.FlowCollector<R of <root>.scopedFlow>, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.FlowCollector<R of <root>.scopedFlow>) returnType:kotlin.Unit
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.FlowCollector<R of <root>.scopedFlow>
|
||||
BLOCK_BODY
|
||||
VAR name:collector type:<root>.FlowCollector<R of <root>.scopedFlow> [val]
|
||||
GET_VAR '<this>: <root>.FlowCollector<R of <root>.scopedFlow> declared in special.<anonymous>' type=<root>.FlowCollector<R of <root>.scopedFlow> origin=null
|
||||
CALL 'public final fun flowScope <R> (block: kotlin.Function1<<root>.CoroutineScope, R of <root>.flowScope>): R of <root>.flowScope [suspend] declared in <root>' type=kotlin.Unit origin=null
|
||||
<R>: kotlin.Unit
|
||||
block: FUN_EXPR type=kotlin.Function1<<root>.CoroutineScope, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.CoroutineScope) returnType:kotlin.Unit
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.CoroutineScope
|
||||
BLOCK_BODY
|
||||
CALL 'public abstract fun invoke (p1: P1 of kotlin.Function2, p2: P2 of kotlin.Function2): R of kotlin.Function2 [operator] declared in kotlin.Function2' type=kotlin.Unit origin=INVOKE
|
||||
$this: GET_VAR 'block: kotlin.Function2<<root>.CoroutineScope, <root>.FlowCollector<R of <root>.scopedFlow>, kotlin.Unit> declared in <root>.scopedFlow' type=kotlin.Function2<<root>.CoroutineScope, <root>.FlowCollector<R of <root>.scopedFlow>, kotlin.Unit> origin=null
|
||||
p1: GET_VAR '<this>: <root>.CoroutineScope declared in special.<anonymous>' type=<root>.CoroutineScope origin=null
|
||||
p2: GET_VAR 'val collector: <root>.FlowCollector<R of <root>.scopedFlow> [val] declared in <root>.scopedFlow.<anonymous>' type=<root>.FlowCollector<R of <root>.scopedFlow> origin=null
|
||||
FUN name:onCompletion visibility:public modality:FINAL <T> ($receiver:<root>.Flow<T of <root>.onCompletion>, action:kotlin.Function2<<root>.FlowCollector<T of <root>.onCompletion>, kotlin.Throwable?, kotlin.Unit>) returnType:<root>.Flow<T of <root>.onCompletion>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.Flow<T of <root>.onCompletion>
|
||||
VALUE_PARAMETER name:action index:0 type:kotlin.Function2<<root>.FlowCollector<T of <root>.onCompletion>, kotlin.Throwable?, kotlin.Unit>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun onCompletion <T> (action: kotlin.Function2<<root>.FlowCollector<T of <root>.onCompletion>, kotlin.Throwable?, kotlin.Unit>): <root>.Flow<T of <root>.onCompletion> declared in <root>'
|
||||
CALL 'public final fun unsafeFlow <T> (block: kotlin.Function1<<root>.FlowCollector<T of <root>.unsafeFlow>, kotlin.Unit>): <root>.Flow<T of <root>.unsafeFlow> [inline] declared in <root>' type=<root>.Flow<T of <root>.onCompletion> origin=null
|
||||
<T>: T of <root>.onCompletion
|
||||
block: FUN_EXPR type=kotlin.Function1<<root>.FlowCollector<T of <root>.onCompletion>, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.FlowCollector<T of <root>.onCompletion>) returnType:kotlin.Unit
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.FlowCollector<T of <root>.onCompletion>
|
||||
BLOCK_BODY
|
||||
VAR name:safeCollector type:<root>.SafeCollector<T of <root>.onCompletion> [val]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (collector: <root>.FlowCollector<T of <root>.SafeCollector>) [primary] declared in <root>.SafeCollector' type=<root>.SafeCollector<T of <root>.onCompletion> origin=null
|
||||
<class: T>: T of <root>.onCompletion
|
||||
collector: GET_VAR '<this>: <root>.FlowCollector<T of <root>.onCompletion> declared in special.<anonymous>' type=<root>.FlowCollector<T of <root>.onCompletion> origin=null
|
||||
CALL 'public final fun invokeSafely <T> (action: kotlin.Function2<<root>.FlowCollector<T of <root>.invokeSafely>, kotlin.Throwable?, kotlin.Unit>): kotlin.Unit [suspend] declared in <root>' type=kotlin.Unit origin=null
|
||||
<T>: T of <root>.onCompletion
|
||||
$receiver: GET_VAR 'val safeCollector: <root>.SafeCollector<T of <root>.onCompletion> [val] declared in <root>.onCompletion.<anonymous>' type=<root>.SafeCollector<T of <root>.onCompletion> origin=null
|
||||
action: GET_VAR 'action: kotlin.Function2<<root>.FlowCollector<T of <root>.onCompletion>, kotlin.Throwable?, kotlin.Unit> declared in <root>.onCompletion' type=kotlin.Function2<<root>.FlowCollector<T of <root>.onCompletion>, kotlin.Throwable?, kotlin.Unit> origin=null
|
||||
FUN name:invokeSafely visibility:public modality:FINAL <T> ($receiver:<root>.FlowCollector<T of <root>.invokeSafely>, action:kotlin.Function2<<root>.FlowCollector<T of <root>.invokeSafely>, kotlin.Throwable?, kotlin.Unit>) returnType:kotlin.Unit [suspend]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.FlowCollector<T of <root>.invokeSafely>
|
||||
VALUE_PARAMETER name:action index:0 type:kotlin.Function2<<root>.FlowCollector<T of <root>.invokeSafely>, kotlin.Throwable?, kotlin.Unit>
|
||||
BLOCK_BODY
|
||||
FUN name:unsafeFlow visibility:public modality:FINAL <T> (block:kotlin.Function1<<root>.FlowCollector<T of <root>.unsafeFlow>, kotlin.Unit>) returnType:<root>.Flow<T of <root>.unsafeFlow> [inline]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:block index:0 type:kotlin.Function1<<root>.FlowCollector<T of <root>.unsafeFlow>, kotlin.Unit> [crossinline]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun unsafeFlow <T> (block: kotlin.Function1<<root>.FlowCollector<T of <root>.unsafeFlow>, kotlin.Unit>): <root>.Flow<T of <root>.unsafeFlow> [inline] declared in <root>'
|
||||
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin' type=kotlin.Nothing origin=null
|
||||
FUN name:onCompletion visibility:public modality:FINAL <T> ($receiver:<root>.Flow<T of <root>.onCompletion>, action:kotlin.Function1<kotlin.Throwable?, kotlin.Unit>) returnType:IrErrorType
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.Flow<T of <root>.onCompletion>
|
||||
VALUE_PARAMETER name:action index:0 type:kotlin.Function1<kotlin.Throwable?, kotlin.Unit>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun onCompletion <T> (action: kotlin.Function1<kotlin.Throwable?, kotlin.Unit>): IrErrorType declared in <root>'
|
||||
ERROR_CALL 'Unresolved reference: <Ambiguity: onCompletion, [/onCompletion, /onCompletion]>#' type=IrErrorType
|
||||
FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'public abstract fun invoke (p1: P1 of kotlin.Function1): R of kotlin.Function1 [operator] declared in kotlin.Function1' type=kotlin.Unit origin=INVOKE
|
||||
$this: GET_VAR 'action: kotlin.Function1<kotlin.Throwable?, kotlin.Unit> declared in <root>.onCompletion' type=kotlin.Function1<kotlin.Throwable?, kotlin.Unit> origin=null
|
||||
p1: ERROR_CALL 'Unresolved reference: <Unresolved name: it>#' type=IrErrorType
|
||||
FUN name:asFairChannel visibility:private modality:FINAL <> ($receiver:<root>.CoroutineScope, flow:<root>.Flow<*>) returnType:<root>.ReceiveChannel<kotlin.Any>
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.CoroutineScope
|
||||
VALUE_PARAMETER name:flow index:0 type:<root>.Flow<*>
|
||||
@@ -72,6 +139,54 @@ FILE fqName:<root> fileName:/castsInsideCoroutineInference.kt
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
|
||||
GET_VAR 'val tmp_1: kotlin.Any? [val] declared in <root>.asChannel.<anonymous>.<anonymous>' type=kotlin.Any? origin=null
|
||||
CLASS CLASS name:SafeCollector modality:FINAL visibility:public superTypes:[<root>.FlowCollector<T of <root>.SafeCollector>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.SafeCollector<T of <root>.SafeCollector>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
CONSTRUCTOR visibility:public <> (collector:<root>.FlowCollector<T of <root>.SafeCollector>) returnType:<root>.SafeCollector<T of <root>.SafeCollector> [primary]
|
||||
VALUE_PARAMETER name:collector index:0 type:<root>.FlowCollector<T of <root>.SafeCollector>
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:SafeCollector modality:FINAL visibility:public superTypes:[<root>.FlowCollector<T of <root>.SafeCollector>]'
|
||||
PROPERTY name:collector visibility:internal modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:collector type:<root>.FlowCollector<T of <root>.SafeCollector> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'collector: <root>.FlowCollector<T of <root>.SafeCollector> declared in <root>.SafeCollector.<init>' type=<root>.FlowCollector<T of <root>.SafeCollector> origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-collector> visibility:internal modality:FINAL <> ($this:<root>.SafeCollector<T of <root>.SafeCollector>) returnType:<root>.FlowCollector<T of <root>.SafeCollector>
|
||||
correspondingProperty: PROPERTY name:collector visibility:internal modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.SafeCollector<T of <root>.SafeCollector>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='internal final fun <get-collector> (): <root>.FlowCollector<T of <root>.SafeCollector> declared in <root>.SafeCollector'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:collector type:<root>.FlowCollector<T of <root>.SafeCollector> visibility:private [final]' type=<root>.FlowCollector<T of <root>.SafeCollector> origin=null
|
||||
receiver: GET_VAR '<this>: <root>.SafeCollector<T of <root>.SafeCollector> declared in <root>.SafeCollector.<get-collector>' type=<root>.SafeCollector<T of <root>.SafeCollector> origin=null
|
||||
FUN name:emit visibility:public modality:FINAL <> ($this:<root>.SafeCollector<T of <root>.SafeCollector>, value:T of <root>.SafeCollector) returnType:kotlin.Unit [suspend]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.SafeCollector<T of <root>.SafeCollector>
|
||||
VALUE_PARAMETER name:value index:0 type:T of <root>.SafeCollector
|
||||
BLOCK_BODY
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:flow visibility:public modality:FINAL <T> (block:kotlin.Function1<<root>.FlowCollector<T of <root>.flow>, kotlin.Unit>) returnType:<root>.Flow<T of <root>.flow>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:block index:0 type:kotlin.Function1<<root>.FlowCollector<T of <root>.flow>, kotlin.Unit>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun flow <T> (block: kotlin.Function1<<root>.FlowCollector<T of <root>.flow>, kotlin.Unit>): <root>.Flow<T of <root>.flow> declared in <root>'
|
||||
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin' type=kotlin.Nothing origin=null
|
||||
FUN name:flowScope visibility:public modality:FINAL <R> (block:kotlin.Function1<<root>.CoroutineScope, R of <root>.flowScope>) returnType:R of <root>.flowScope [suspend]
|
||||
TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:block index:0 type:kotlin.Function1<<root>.CoroutineScope, R of <root>.flowScope>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun flowScope <R> (block: kotlin.Function1<<root>.CoroutineScope, R of <root>.flowScope>): R of <root>.flowScope [suspend] declared in <root>'
|
||||
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin' type=kotlin.Nothing origin=null
|
||||
FUN name:collect visibility:public modality:FINAL <T> ($receiver:<root>.Flow<T of <root>.collect>, action:kotlin.Function1<T of <root>.collect, kotlin.Unit>) returnType:kotlin.Unit [inline,suspend]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.Flow<T of <root>.collect>
|
||||
|
||||
@@ -1,7 +1,35 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <R> scopedFlow(@BuilderInference block: suspend CoroutineScope.(FlowCollector<R>) -> Unit): Flow<R> =
|
||||
flow {
|
||||
val collector = this
|
||||
flowScope { block(collector) }
|
||||
}
|
||||
|
||||
public fun <T> Flow<T>.onCompletion(
|
||||
action: suspend FlowCollector<T>.(cause: Throwable?) -> Unit
|
||||
): Flow<T> = unsafeFlow {
|
||||
val safeCollector = SafeCollector(this)
|
||||
safeCollector.invokeSafely(action)
|
||||
}
|
||||
|
||||
suspend fun <T> FlowCollector<T>.invokeSafely(
|
||||
action: suspend FlowCollector<T>.(cause: Throwable?) -> Unit
|
||||
) {
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
inline fun <T> unsafeFlow(@BuilderInference crossinline block: suspend FlowCollector<T>.() -> Unit): Flow<T> = TODO()
|
||||
|
||||
@Deprecated(level = DeprecationLevel.HIDDEN, message = "binary compatibility with a version w/o FlowCollector receiver")
|
||||
public fun <T> Flow<T>.onCompletion(action: suspend (cause: Throwable?) -> Unit) =
|
||||
onCompletion { action(it) }
|
||||
|
||||
private fun CoroutineScope.asFairChannel(flow: Flow<*>): ReceiveChannel<Any> = produce {
|
||||
val channel = channel as ChannelCoroutine<Any>
|
||||
flow.collect { value ->
|
||||
@@ -15,6 +43,18 @@ private fun CoroutineScope.asChannel(flow: Flow<*>): ReceiveChannel<Any> = produ
|
||||
}
|
||||
}
|
||||
|
||||
class SafeCollector<T> constructor(
|
||||
internal val collector: FlowCollector<T>
|
||||
) : FlowCollector<T> {
|
||||
override suspend fun emit(value: T) {}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <T> flow(@BuilderInference block: suspend FlowCollector<T>.() -> Unit): Flow<T> = TODO()
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
suspend fun <R> flowScope(@BuilderInference block: suspend CoroutineScope.() -> R): R = TODO()
|
||||
|
||||
suspend inline fun <T> Flow<T>.collect(crossinline action: suspend (value: T) -> Unit) {}
|
||||
|
||||
open class ChannelCoroutine<E> {
|
||||
|
||||
@@ -1,4 +1,84 @@
|
||||
FILE fqName:<root> fileName:/castsInsideCoroutineInference.kt
|
||||
FUN name:scopedFlow visibility:public modality:FINAL <R> (block:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.CoroutineScope, <root>.FlowCollector<R of <root>.scopedFlow>, kotlin.Unit>) returnType:<root>.Flow<R of <root>.scopedFlow>
|
||||
annotations:
|
||||
OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalTypeInference modality:FINAL visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass<kotlin.experimental.ExperimentalTypeInference>])
|
||||
TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:block index:0 type:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.CoroutineScope, <root>.FlowCollector<R of <root>.scopedFlow>, kotlin.Unit>
|
||||
annotations:
|
||||
BuilderInference
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun scopedFlow <R> (block: @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.CoroutineScope, <root>.FlowCollector<R of <root>.scopedFlow>, kotlin.Unit>): <root>.Flow<R of <root>.scopedFlow> declared in <root>'
|
||||
CALL 'public final fun flow <T> (block: @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<<root>.FlowCollector<T of <root>.flow>, kotlin.Unit>): <root>.Flow<T of <root>.flow> declared in <root>' type=<root>.Flow<R of <root>.scopedFlow> origin=null
|
||||
<T>: R of <root>.scopedFlow
|
||||
block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<<root>.FlowCollector<R of <root>.scopedFlow>, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.FlowCollector<R of <root>.scopedFlow>) returnType:kotlin.Unit [suspend]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.FlowCollector<R of <root>.scopedFlow>
|
||||
BLOCK_BODY
|
||||
VAR name:collector type:<root>.FlowCollector<R of <root>.scopedFlow> [val]
|
||||
GET_VAR '<this>: <root>.FlowCollector<R of <root>.scopedFlow> declared in <root>.scopedFlow.<anonymous>' type=<root>.FlowCollector<R of <root>.scopedFlow> origin=null
|
||||
CALL 'public final fun flowScope <R> (block: @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<<root>.CoroutineScope, R of <root>.flowScope>): R of <root>.flowScope [suspend] declared in <root>' type=kotlin.Unit origin=null
|
||||
<R>: kotlin.Unit
|
||||
block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<<root>.CoroutineScope, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.CoroutineScope) returnType:kotlin.Unit [suspend]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.CoroutineScope
|
||||
BLOCK_BODY
|
||||
CALL 'public abstract fun invoke (p1: P1 of kotlin.coroutines.SuspendFunction2, p2: P2 of kotlin.coroutines.SuspendFunction2): R of kotlin.coroutines.SuspendFunction2 [suspend,operator] declared in kotlin.coroutines.SuspendFunction2' type=kotlin.Unit origin=INVOKE
|
||||
$this: GET_VAR 'block: @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.CoroutineScope, <root>.FlowCollector<R of <root>.scopedFlow>, kotlin.Unit> declared in <root>.scopedFlow' type=@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.CoroutineScope, <root>.FlowCollector<R of <root>.scopedFlow>, kotlin.Unit> origin=VARIABLE_AS_FUNCTION
|
||||
p1: GET_VAR '<this>: <root>.CoroutineScope declared in <root>.scopedFlow.<anonymous>.<anonymous>' type=<root>.CoroutineScope origin=null
|
||||
p2: GET_VAR 'val collector: <root>.FlowCollector<R of <root>.scopedFlow> [val] declared in <root>.scopedFlow.<anonymous>' type=<root>.FlowCollector<R of <root>.scopedFlow> origin=null
|
||||
FUN name:onCompletion visibility:public modality:FINAL <T> ($receiver:<root>.Flow<T of <root>.onCompletion>, action:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.FlowCollector<T of <root>.onCompletion>, @[ParameterName(name = 'cause')] kotlin.Throwable?, kotlin.Unit>) returnType:<root>.Flow<T of <root>.onCompletion>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.Flow<T of <root>.onCompletion>
|
||||
VALUE_PARAMETER name:action index:0 type:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.FlowCollector<T of <root>.onCompletion>, @[ParameterName(name = 'cause')] kotlin.Throwable?, kotlin.Unit>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun onCompletion <T> (action: @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.FlowCollector<T of <root>.onCompletion>, @[ParameterName(name = 'cause')] kotlin.Throwable?, kotlin.Unit>): <root>.Flow<T of <root>.onCompletion> declared in <root>'
|
||||
CALL 'public final fun unsafeFlow <T> (block: @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<<root>.FlowCollector<T of <root>.unsafeFlow>, kotlin.Unit>): <root>.Flow<T of <root>.unsafeFlow> [inline] declared in <root>' type=<root>.Flow<T of <root>.onCompletion> origin=null
|
||||
<T>: T of <root>.onCompletion
|
||||
block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<<root>.FlowCollector<T of <root>.onCompletion>, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.FlowCollector<T of <root>.onCompletion>) returnType:kotlin.Unit [suspend]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.FlowCollector<T of <root>.onCompletion>
|
||||
BLOCK_BODY
|
||||
VAR name:safeCollector type:<root>.SafeCollector<T of <root>.onCompletion> [val]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (collector: <root>.FlowCollector<T of <root>.SafeCollector>) [primary] declared in <root>.SafeCollector' type=<root>.SafeCollector<T of <root>.onCompletion> origin=null
|
||||
<class: T>: T of <root>.onCompletion
|
||||
collector: GET_VAR '<this>: <root>.FlowCollector<T of <root>.onCompletion> declared in <root>.onCompletion.<anonymous>' type=<root>.FlowCollector<T of <root>.onCompletion> origin=null
|
||||
CALL 'public final fun invokeSafely <T> (action: @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.FlowCollector<T of <root>.invokeSafely>, @[ParameterName(name = 'cause')] kotlin.Throwable?, kotlin.Unit>): kotlin.Unit [suspend] declared in <root>' type=kotlin.Unit origin=null
|
||||
<T>: T of <root>.onCompletion
|
||||
$receiver: GET_VAR 'val safeCollector: <root>.SafeCollector<T of <root>.onCompletion> [val] declared in <root>.onCompletion.<anonymous>' type=<root>.SafeCollector<T of <root>.onCompletion> origin=null
|
||||
action: GET_VAR 'action: @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.FlowCollector<T of <root>.onCompletion>, @[ParameterName(name = 'cause')] kotlin.Throwable?, kotlin.Unit> declared in <root>.onCompletion' type=@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.FlowCollector<T of <root>.onCompletion>, @[ParameterName(name = 'cause')] kotlin.Throwable?, kotlin.Unit> origin=null
|
||||
FUN name:invokeSafely visibility:public modality:FINAL <T> ($receiver:<root>.FlowCollector<T of <root>.invokeSafely>, action:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.FlowCollector<T of <root>.invokeSafely>, @[ParameterName(name = 'cause')] kotlin.Throwable?, kotlin.Unit>) returnType:kotlin.Unit [suspend]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.FlowCollector<T of <root>.invokeSafely>
|
||||
VALUE_PARAMETER name:action index:0 type:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.FlowCollector<T of <root>.invokeSafely>, @[ParameterName(name = 'cause')] kotlin.Throwable?, kotlin.Unit>
|
||||
BLOCK_BODY
|
||||
FUN name:unsafeFlow visibility:public modality:FINAL <T> (block:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<<root>.FlowCollector<T of <root>.unsafeFlow>, kotlin.Unit>) returnType:<root>.Flow<T of <root>.unsafeFlow> [inline]
|
||||
annotations:
|
||||
OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalTypeInference modality:FINAL visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass<kotlin.experimental.ExperimentalTypeInference>])
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:block index:0 type:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<<root>.FlowCollector<T of <root>.unsafeFlow>, kotlin.Unit> [crossinline]
|
||||
annotations:
|
||||
BuilderInference
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin' type=kotlin.Nothing origin=null
|
||||
FUN name:onCompletion visibility:public modality:FINAL <T> ($receiver:<root>.Flow<T of <root>.onCompletion>, action:kotlin.coroutines.SuspendFunction1<@[ParameterName(name = 'cause')] kotlin.Throwable?, kotlin.Unit>) returnType:<root>.Flow<T of <root>.onCompletion>
|
||||
annotations:
|
||||
Deprecated(message = 'binary compatibility with a version w/o FlowCollector receiver', replaceWith = <null>, level = GET_ENUM 'ENUM_ENTRY IR_EXTERNAL_DECLARATION_STUB name:HIDDEN' type=kotlin.DeprecationLevel)
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.Flow<T of <root>.onCompletion>
|
||||
VALUE_PARAMETER name:action index:0 type:kotlin.coroutines.SuspendFunction1<@[ParameterName(name = 'cause')] kotlin.Throwable?, kotlin.Unit>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun onCompletion <T> (action: kotlin.coroutines.SuspendFunction1<@[ParameterName(name = 'cause')] kotlin.Throwable?, kotlin.Unit>): <root>.Flow<T of <root>.onCompletion> declared in <root>'
|
||||
CALL 'public final fun onCompletion <T> (action: @[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.FlowCollector<T of <root>.onCompletion>, @[ParameterName(name = 'cause')] kotlin.Throwable?, kotlin.Unit>): <root>.Flow<T of <root>.onCompletion> declared in <root>' type=<root>.Flow<T of <root>.onCompletion> origin=null
|
||||
<T>: T of <root>.onCompletion
|
||||
$receiver: GET_VAR '<this>: <root>.Flow<T of <root>.onCompletion> declared in <root>.onCompletion' type=<root>.Flow<T of <root>.onCompletion> origin=null
|
||||
action: FUN_EXPR type=@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction2<<root>.FlowCollector<T of <root>.onCompletion>, @[ParameterName(name = 'cause')] kotlin.Throwable?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.FlowCollector<T of <root>.onCompletion>, it:kotlin.Throwable?) returnType:kotlin.Unit [suspend]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.FlowCollector<T of <root>.onCompletion>
|
||||
VALUE_PARAMETER name:it index:0 type:kotlin.Throwable?
|
||||
BLOCK_BODY
|
||||
CALL 'public abstract fun invoke (p1: P1 of kotlin.coroutines.SuspendFunction1): R of kotlin.coroutines.SuspendFunction1 [suspend,operator] declared in kotlin.coroutines.SuspendFunction1' type=kotlin.Unit origin=INVOKE
|
||||
$this: GET_VAR 'action: kotlin.coroutines.SuspendFunction1<@[ParameterName(name = 'cause')] kotlin.Throwable?, kotlin.Unit> declared in <root>.onCompletion' type=kotlin.coroutines.SuspendFunction1<@[ParameterName(name = 'cause')] kotlin.Throwable?, kotlin.Unit> origin=VARIABLE_AS_FUNCTION
|
||||
p1: GET_VAR 'it: kotlin.Throwable? declared in <root>.onCompletion.<anonymous>' type=kotlin.Throwable? origin=null
|
||||
FUN name:asFairChannel visibility:private modality:FINAL <> ($receiver:<root>.CoroutineScope, flow:<root>.Flow<*>) returnType:<root>.ReceiveChannel<kotlin.Any>
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.CoroutineScope
|
||||
VALUE_PARAMETER name:flow index:0 type:<root>.Flow<*>
|
||||
@@ -72,6 +152,62 @@ FILE fqName:<root> fileName:/castsInsideCoroutineInference.kt
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val tmp_1: kotlin.Any? [val] declared in <root>.asChannel.<anonymous>.<anonymous>' type=kotlin.Any? origin=null
|
||||
CLASS CLASS name:SafeCollector modality:FINAL visibility:public superTypes:[<root>.FlowCollector<T of <root>.SafeCollector>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.SafeCollector<T of <root>.SafeCollector>
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
CONSTRUCTOR visibility:public <> (collector:<root>.FlowCollector<T of <root>.SafeCollector>) returnType:<root>.SafeCollector<T of <root>.SafeCollector> [primary]
|
||||
VALUE_PARAMETER name:collector index:0 type:<root>.FlowCollector<T of <root>.SafeCollector>
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:SafeCollector modality:FINAL visibility:public superTypes:[<root>.FlowCollector<T of <root>.SafeCollector>]'
|
||||
PROPERTY name:collector visibility:internal modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:collector type:<root>.FlowCollector<T of <root>.SafeCollector> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'collector: <root>.FlowCollector<T of <root>.SafeCollector> declared in <root>.SafeCollector.<init>' type=<root>.FlowCollector<T of <root>.SafeCollector> origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-collector> visibility:internal modality:FINAL <> ($this:<root>.SafeCollector<T of <root>.SafeCollector>) returnType:<root>.FlowCollector<T of <root>.SafeCollector>
|
||||
correspondingProperty: PROPERTY name:collector visibility:internal modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.SafeCollector<T of <root>.SafeCollector>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='internal final fun <get-collector> (): <root>.FlowCollector<T of <root>.SafeCollector> declared in <root>.SafeCollector'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:collector type:<root>.FlowCollector<T of <root>.SafeCollector> visibility:private [final]' type=<root>.FlowCollector<T of <root>.SafeCollector> origin=null
|
||||
receiver: GET_VAR '<this>: <root>.SafeCollector<T of <root>.SafeCollector> declared in <root>.SafeCollector.<get-collector>' type=<root>.SafeCollector<T of <root>.SafeCollector> origin=null
|
||||
FUN name:emit visibility:public modality:OPEN <> ($this:<root>.SafeCollector<T of <root>.SafeCollector>, value:T of <root>.SafeCollector) returnType:kotlin.Unit [suspend]
|
||||
overridden:
|
||||
public abstract fun emit (value: T of <root>.FlowCollector): kotlin.Unit [suspend] declared in <root>.FlowCollector
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.SafeCollector<T of <root>.SafeCollector>
|
||||
VALUE_PARAMETER name:value index:0 type:T of <root>.SafeCollector
|
||||
BLOCK_BODY
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.FlowCollector
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.FlowCollector
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String [fake_override] declared in <root>.FlowCollector
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:flow visibility:public modality:FINAL <T> (block:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<<root>.FlowCollector<T of <root>.flow>, kotlin.Unit>) returnType:<root>.Flow<T of <root>.flow>
|
||||
annotations:
|
||||
OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalTypeInference modality:FINAL visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass<kotlin.experimental.ExperimentalTypeInference>])
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:block index:0 type:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<<root>.FlowCollector<T of <root>.flow>, kotlin.Unit>
|
||||
annotations:
|
||||
BuilderInference
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin' type=kotlin.Nothing origin=null
|
||||
FUN name:flowScope visibility:public modality:FINAL <R> (block:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<<root>.CoroutineScope, R of <root>.flowScope>) returnType:R of <root>.flowScope [suspend]
|
||||
annotations:
|
||||
OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalTypeInference modality:FINAL visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass<kotlin.experimental.ExperimentalTypeInference>])
|
||||
TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:block index:0 type:@[ExtensionFunctionType] kotlin.coroutines.SuspendFunction1<<root>.CoroutineScope, R of <root>.flowScope>
|
||||
annotations:
|
||||
BuilderInference
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin' type=kotlin.Nothing origin=null
|
||||
FUN name:collect visibility:public modality:FINAL <T> ($receiver:<root>.Flow<T of <root>.collect>, action:kotlin.coroutines.SuspendFunction1<@[ParameterName(name = 'value')] T of <root>.collect, kotlin.Unit>) returnType:kotlin.Unit [inline,suspend]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.Flow<T of <root>.collect>
|
||||
|
||||
+25
@@ -1967,6 +1967,16 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt15516.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt32097.kt")
|
||||
public void testKt32097() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt32097.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt32203.kt")
|
||||
public void testKt32203() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt32203.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt32271.kt")
|
||||
public void testKt32271() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt32271.kt");
|
||||
@@ -1977,11 +1987,26 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt33542.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt35306.kt")
|
||||
public void testKt35306() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt35306.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt35684.kt")
|
||||
public void testKt35684() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt35684.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt36202.kt")
|
||||
public void testKt36202() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt36202.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt36220.kt")
|
||||
public void testKt36220() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt36220.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedLambdaInferenceWithListMap.kt")
|
||||
public void testNestedLambdaInferenceWithListMap() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/nestedLambdaInferenceWithListMap.kt");
|
||||
|
||||
compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java
Generated
+25
@@ -1967,6 +1967,16 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt15516.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt32097.kt")
|
||||
public void testKt32097() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt32097.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt32203.kt")
|
||||
public void testKt32203() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt32203.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt32271.kt")
|
||||
public void testKt32271() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt32271.kt");
|
||||
@@ -1977,11 +1987,26 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt33542.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt35306.kt")
|
||||
public void testKt35306() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt35306.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt35684.kt")
|
||||
public void testKt35684() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt35684.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt36202.kt")
|
||||
public void testKt36202() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt36202.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt36220.kt")
|
||||
public void testKt36220() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt36220.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedLambdaInferenceWithListMap.kt")
|
||||
public void testNestedLambdaInferenceWithListMap() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/nestedLambdaInferenceWithListMap.kt");
|
||||
|
||||
Reference in New Issue
Block a user