FIR: substitute the whole lambda body after builder inference

This commit is contained in:
Tianyu Geng
2021-07-26 15:56:56 -07:00
committed by teamcityserver
parent f737d8002e
commit 0026560bd7
7 changed files with 30 additions and 27 deletions
+2 -1
View File
@@ -19,7 +19,7 @@ fun <E : Any?, C : Base<E>> Receiver<E>.toChannel(destination: C): C {
}
fun <R : Any?> foo(r: Receiver<R>): R {
return produce<R>(block = local fun Derived<R>.<anonymous>() {
return produce<R>(block = local fun Derived<ErrorType>.<anonymous>() {
r.toChannel<R, Derived<ErrorType>>(destination = <this>) /*~> Unit */
}
)
@@ -28,3 +28,4 @@ fun <R : Any?> foo(r: Receiver<R>): R {
fun box(): String {
return "OK"
}
+4 -4
View File
@@ -72,16 +72,16 @@ FILE fqName:<root> fileName:/kt47082.kt
RETURN type=kotlin.Nothing from='public final fun foo <R> (r: <root>.Receiver<R of <root>.foo>): R of <root>.foo declared in <root>'
CALL 'public final fun produce <E> (block: @[ExtensionFunctionType] kotlin.Function1<<root>.Derived<E of <root>.produce>, kotlin.Unit>): E of <root>.produce declared in <root>' type=R of <root>.foo origin=null
<E>: R of <root>.foo
block: FUN_EXPR type=kotlin.Function1<<root>.Derived<R of <root>.foo>, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.Derived<R of <root>.foo>) returnType:kotlin.Unit
$receiver: VALUE_PARAMETER name:<this> type:<root>.Derived<R of <root>.foo>
block: FUN_EXPR type=kotlin.Function1<<root>.Derived<IrErrorType(null)>, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.Derived<IrErrorType(null)>) returnType:kotlin.Unit
$receiver: VALUE_PARAMETER name:<this> type:<root>.Derived<IrErrorType(null)>
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public final fun toChannel <E, C> (destination: C of <root>.toChannel): C of <root>.toChannel declared in <root>' type=<root>.Derived<IrErrorType(null)> origin=null
<E>: R of <root>.foo
<C>: <root>.Derived<IrErrorType(null)>
$receiver: GET_VAR 'r: <root>.Receiver<R of <root>.foo> declared in <root>.foo' type=<root>.Receiver<R of <root>.foo> origin=null
destination: GET_VAR '<this>: <root>.Derived<R of <root>.foo> declared in <root>.foo.<anonymous>' type=<root>.Derived<IrErrorType(null)> origin=null
destination: GET_VAR '<this>: <root>.Derived<IrErrorType(null)> declared in <root>.foo.<anonymous>' type=<root>.Derived<IrErrorType(null)> origin=null
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'