psi2ir: Fix return insertion

We should only insert a return statement at the end of a lambda or
function if the final statement is used as an expression (slice
USED_AS_RESULT_OF_LAMBDA and USED_AS_EXPRESSION).
This commit is contained in:
Steven Schäfer
2019-10-24 09:50:50 +02:00
committed by Dmitry Petrov
parent b3e733ea4f
commit 0da4b06074
19 changed files with 127 additions and 72 deletions
@@ -3,8 +3,7 @@ FILE fqName:<root> fileName:/argumentMappedWithError.kt
TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Number]
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Number
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun convert <R> (): R of <root>.convert declared in <root>'
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin' type=kotlin.Nothing origin=null
CALL 'public final fun TODO (): kotlin.Nothing [inline] declared in kotlin' type=kotlin.Nothing origin=null
FUN name:foo visibility:public modality:FINAL <> (arg:kotlin.Number) returnType:kotlin.Unit
VALUE_PARAMETER name:arg index:0 type:kotlin.Number
BLOCK_BODY