[FIR] Don't create smartcast node if smartcasted type is equal to original type

This commit is contained in:
Dmitriy Novozhilov
2021-02-19 17:47:44 +03:00
parent 1c0d862e40
commit 469252f6b4
30 changed files with 272 additions and 271 deletions
@@ -3,7 +3,7 @@ fun <R : Any?> scopedFlow(@BuilderInference block: @ExtensionFunctionType Suspen
return flow<R>(block = local suspend fun FlowCollector<R>.<anonymous>() {
val collector: FlowCollector<ErrorType> = <this>
flowScope<Unit>(block = local suspend fun CoroutineScope.<anonymous>() {
block.invoke(p1 = <this>, p2 = collector /*as FlowCollector<ErrorType> */)
block.invoke(p1 = <this>, p2 = collector)
}
)
}
@@ -141,3 +141,4 @@ interface SendChannel<in E : Any?> {
abstract suspend fun send(e: E)
}
@@ -25,8 +25,7 @@ FILE fqName:<root> fileName:/castsInsideCoroutineInference.kt
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=null
$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: TYPE_OP type=<root>.FlowCollector<IrErrorType> origin=IMPLICIT_CAST typeOperand=<root>.FlowCollector<IrErrorType>
GET_VAR 'val collector: <root>.FlowCollector<IrErrorType> [val] declared in <root>.scopedFlow.<anonymous>' type=<root>.FlowCollector<R of <root>.scopedFlow> origin=null
p2: GET_VAR 'val collector: <root>.FlowCollector<IrErrorType> [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>, 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>