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
@@ -1286,6 +1286,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
runTest("compiler/testData/ir/irText/expressions/whenReturn.kt");
}
@TestMetadata("whenReturnUnit.kt")
public void testWhenReturnUnit() throws Exception {
runTest("compiler/testData/ir/irText/expressions/whenReturnUnit.kt");
}
@TestMetadata("whenUnusedExpression.kt")
public void testWhenUnusedExpression() throws Exception {
runTest("compiler/testData/ir/irText/expressions/whenUnusedExpression.kt");