[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:
Juan Chen
2020-02-01 18:18:03 -08:00
committed by Mikhail Glukhikh
parent 5eedba3903
commit 7249d2f889
194 changed files with 397 additions and 506 deletions
@@ -38,7 +38,8 @@ FILE fqName:<root> fileName:/objectReferenceInClosureInSuperConstructorCall.kt
lambda: FUN_EXPR type=kotlin.Function0<kotlin.Any> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Any
BLOCK_BODY
GET_OBJECT 'CLASS OBJECT name:Test modality:FINAL visibility:public superTypes:[<root>.Base]' type=<root>.Test
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Any declared in <root>.Test.<init>'
GET_OBJECT 'CLASS OBJECT name:Test modality:FINAL visibility:public superTypes:[<root>.Base]' type=<root>.Test
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Test modality:FINAL visibility:public superTypes:[<root>.Base]'
PROPERTY FAKE_OVERRIDE name:lambda visibility:public modality:FINAL [fake_override,val]
FUN FAKE_OVERRIDE name:<get-lambda> visibility:public modality:FINAL <> ($this:<root>.Test) returnType:kotlin.Function0<kotlin.Any> [fake_override]