IR: Fix scope transparency in ReturnableBlockLowering
An IrReturnableBlock introduces a new variable scope and shouldn't be replaced with a transparent IrComposite block.
This commit is contained in:
committed by
Alexander Udalov
parent
b93c000250
commit
6f0ff6aeb0
+12
@@ -15993,6 +15993,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/contructorRef.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53202.kt")
|
||||
public void testKt53202() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/kt53202.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53202_funLiteral.kt")
|
||||
public void testKt53202_funLiteral() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/kt53202_funLiteral.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nestedLambdas.kt")
|
||||
public void testNestedLambdas() throws Exception {
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ class ReturnableBlockTransformer(val context: CommonBackendContext, val containe
|
||||
returnMap.remove(expression.symbol)
|
||||
|
||||
if (!hasReturned) {
|
||||
return IrCompositeImpl(
|
||||
return IrBlockImpl(
|
||||
expression.startOffset,
|
||||
expression.endOffset,
|
||||
expression.type,
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
fun box(): String {
|
||||
val a = "OK"
|
||||
|
||||
val c = {
|
||||
val b = a
|
||||
b
|
||||
}.invoke()
|
||||
|
||||
return a
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fun box(): String {
|
||||
val a = "OK"
|
||||
|
||||
val c = (fun(): String {
|
||||
val b = a
|
||||
return b
|
||||
}).invoke()
|
||||
|
||||
return a
|
||||
}
|
||||
+12
@@ -15807,6 +15807,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/contructorRef.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53202.kt")
|
||||
public void testKt53202() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/kt53202.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53202_funLiteral.kt")
|
||||
public void testKt53202_funLiteral() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/kt53202_funLiteral.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nestedLambdas.kt")
|
||||
public void testNestedLambdas() throws Exception {
|
||||
|
||||
+12
@@ -15993,6 +15993,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/contructorRef.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53202.kt")
|
||||
public void testKt53202() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/kt53202.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53202_funLiteral.kt")
|
||||
public void testKt53202_funLiteral() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/kt53202_funLiteral.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nestedLambdas.kt")
|
||||
public void testNestedLambdas() throws Exception {
|
||||
|
||||
+10
@@ -13020,6 +13020,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/contructorRef.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt53202.kt")
|
||||
public void testKt53202() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/kt53202.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt53202_funLiteral.kt")
|
||||
public void testKt53202_funLiteral() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/kt53202_funLiteral.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedLambdas.kt")
|
||||
public void testNestedLambdas() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/nestedLambdas.kt");
|
||||
|
||||
+12
@@ -12197,6 +12197,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/contructorRef.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53202.kt")
|
||||
public void testKt53202() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/kt53202.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53202_funLiteral.kt")
|
||||
public void testKt53202_funLiteral() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/kt53202_funLiteral.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nestedLambdas.kt")
|
||||
public void testNestedLambdas() throws Exception {
|
||||
|
||||
+12
@@ -12239,6 +12239,18 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/contructorRef.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53202.kt")
|
||||
public void testKt53202() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/kt53202.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53202_funLiteral.kt")
|
||||
public void testKt53202_funLiteral() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/kt53202_funLiteral.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nestedLambdas.kt")
|
||||
public void testNestedLambdas() throws Exception {
|
||||
|
||||
+10
@@ -10870,6 +10870,16 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/contructorRef.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt53202.kt")
|
||||
public void testKt53202() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/kt53202.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt53202_funLiteral.kt")
|
||||
public void testKt53202_funLiteral() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/kt53202_funLiteral.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedLambdas.kt")
|
||||
public void testNestedLambdas() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/nestedLambdas.kt");
|
||||
|
||||
+12
@@ -13243,6 +13243,18 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/contructorRef.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53202.kt")
|
||||
public void testKt53202() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/kt53202.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt53202_funLiteral.kt")
|
||||
public void testKt53202_funLiteral() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/directInvokeOptimization/kt53202_funLiteral.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nestedLambdas.kt")
|
||||
public void testNestedLambdas() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user