[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
+2
-1
@@ -29,4 +29,5 @@ FILE fqName:<root> fileName:/basicFunInterfaceConversion.kt
|
||||
f: FUN_EXPR type=kotlin.Function0<kotlin.String> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
|
||||
BLOCK_BODY
|
||||
CONST String type=kotlin.String value="OK"
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.test'
|
||||
CONST String type=kotlin.String value="OK"
|
||||
|
||||
@@ -115,7 +115,8 @@ FILE fqName:<root> fileName:/partialSam.kt
|
||||
VALUE_PARAMETER name:i index:1 type:kotlin.Int
|
||||
VALUE_PARAMETER name:ti index:2 type:kotlin.Int
|
||||
BLOCK_BODY
|
||||
CONST String type=kotlin.String value=""
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (s: kotlin.String, i: kotlin.Int, ti: kotlin.Int): kotlin.String declared in <root>.test'
|
||||
CONST String type=kotlin.String value=""
|
||||
CALL 'public final fun runConversion (f1: <root>.Fn<kotlin.String, kotlin.Int>, f2: <root>.Fn<kotlin.Int, kotlin.String>): kotlin.Int declared in <root>.J' type=kotlin.Int origin=null
|
||||
$this: GET_VAR 'j: <root>.J declared in <root>.test' type=<root>.J origin=null
|
||||
f1: FUN_EXPR type=kotlin.Function3<kotlin.String, kotlin.Int, kotlin.String, kotlin.Int> origin=LAMBDA
|
||||
@@ -124,5 +125,6 @@ FILE fqName:<root> fileName:/partialSam.kt
|
||||
VALUE_PARAMETER name:i index:1 type:kotlin.Int
|
||||
VALUE_PARAMETER name:ts index:2 type:kotlin.String
|
||||
BLOCK_BODY
|
||||
CONST Int type=kotlin.Int value=1
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (s: kotlin.String, i: kotlin.Int, ts: kotlin.String): kotlin.Int declared in <root>.test'
|
||||
CONST Int type=kotlin.Int value=1
|
||||
f2: CALL 'public final fun <get-fis> (): <uninitialized parent>.<anonymous> declared in <root>' type=<uninitialized parent>.<anonymous> origin=null
|
||||
|
||||
Reference in New Issue
Block a user