[FIR] Fix translation of invokes & add return expressions for lambdas
* fixed NoSuchMethod caused by mismatched signatures of the "invoke" method generated for lambda arguments * added test cases in invoke.kt for KFunction and anonymous functions * added a transformer to wrap the last expression in the bodies of lambdas with return
This commit is contained in:
committed by
Mikhail Glukhikh
parent
5eedba3903
commit
7249d2f889
+4
-3
@@ -7,12 +7,13 @@ FILE fqName:<root> fileName:/variableAsFunctionCallWithGenerics.kt
|
||||
FUN_EXPR type=kotlin.Function0<T of <uninitialized parent>> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:T of <uninitialized parent>
|
||||
BLOCK_BODY
|
||||
ERROR_CALL 'Unresolved reference: this@R|/gk|' type=T of <uninitialized parent>
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): T of <uninitialized parent> declared in <root>.<get-gk>'
|
||||
ERROR_CALL 'Unresolved reference: this@R|/gk|' type=T of <uninitialized parent>
|
||||
FUN name:testGeneric1 visibility:public modality:FINAL <> (x:kotlin.String) returnType:T of <uninitialized parent>
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testGeneric1 (x: kotlin.String): T of <uninitialized parent> declared in <root>'
|
||||
CALL 'public abstract fun invoke (): T of <uninitialized parent> [operator] declared in kotlin.Function0' type=T of <uninitialized parent> origin=null
|
||||
CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=T of <uninitialized parent> origin=INVOKE
|
||||
$this: CALL 'public final fun <get-gk> (): kotlin.Function0<T of <uninitialized parent>> declared in <root>' type=kotlin.Function0<kotlin.String> origin=null
|
||||
PROPERTY name:kt26531Val visibility:public modality:FINAL [val]
|
||||
FUN name:<get-kt26531Val> visibility:public modality:FINAL <> () returnType:kotlin.Function0<T of <uninitialized parent>>
|
||||
@@ -27,5 +28,5 @@ FILE fqName:<root> fileName:/variableAsFunctionCallWithGenerics.kt
|
||||
FUN name:kt26531 visibility:public modality:FINAL <> () returnType:T of <uninitialized parent>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun kt26531 (): T of <uninitialized parent> declared in <root>'
|
||||
CALL 'public abstract fun invoke (): T of <uninitialized parent> [operator] declared in kotlin.Function0' type=T of <uninitialized parent> origin=null
|
||||
CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=T of <uninitialized parent> origin=INVOKE
|
||||
$this: CALL 'public final fun <get-kt26531Val> (): kotlin.Function0<T of <uninitialized parent>> declared in <root>' type=kotlin.Function0<kotlin.Int> origin=null
|
||||
|
||||
Reference in New Issue
Block a user