[FIR2IR] Fix unwrapping of single-statement blocks
Unwrapping should be done with respect to `forceUnitType` parameter. ^KT-65019: Fixed
This commit is contained in:
committed by
Space Team
parent
5b7478c0a6
commit
8b1d87848d
+6
@@ -19726,6 +19726,12 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
+6
@@ -19726,6 +19726,12 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
@@ -1146,7 +1146,7 @@ class Fir2IrVisitor(
|
|||||||
} else {
|
} else {
|
||||||
val irStatements = mapToIrStatements()
|
val irStatements = mapToIrStatements()
|
||||||
val singleStatement = irStatements.singleOrNull()
|
val singleStatement = irStatements.singleOrNull()
|
||||||
if (origin?.isLoop != true && singleStatement is IrBlock &&
|
if (singleStatement is IrBlock && (!forceUnitType || singleStatement.type.isUnit()) &&
|
||||||
(singleStatement.origin == IrStatementOrigin.POSTFIX_INCR || singleStatement.origin == IrStatementOrigin.POSTFIX_DECR)
|
(singleStatement.origin == IrStatementOrigin.POSTFIX_INCR || singleStatement.origin == IrStatementOrigin.POSTFIX_DECR)
|
||||||
) {
|
) {
|
||||||
singleStatement
|
singleStatement
|
||||||
|
|||||||
+6
@@ -19455,6 +19455,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
+6
@@ -19455,6 +19455,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
+6
@@ -19455,6 +19455,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
fun box(): String {
|
||||||
|
var variable = 0
|
||||||
|
try {
|
||||||
|
try {
|
||||||
|
null!!
|
||||||
|
} finally {
|
||||||
|
variable--
|
||||||
|
}
|
||||||
|
} catch (e: NullPointerException) {
|
||||||
|
return if (variable == -1) "OK" else "Fail"
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
@@ -19455,6 +19455,12 @@ public class JvmAbiConsistencyTestBoxGenerated extends AbstractJvmAbiConsistency
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
+6
@@ -18609,6 +18609,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
+6
@@ -19455,6 +19455,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
+6
@@ -19455,6 +19455,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
+5
@@ -16237,6 +16237,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/finally/finallyAndFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/finallyAndFinally.kt");
|
||||||
|
|||||||
+6
@@ -14607,6 +14607,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
Generated
+6
@@ -14607,6 +14607,12 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
+6
@@ -14607,6 +14607,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
+6
@@ -14607,6 +14607,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
+6
@@ -16472,6 +16472,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
+6
@@ -16858,6 +16858,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
+6
@@ -16086,6 +16086,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
+6
@@ -16473,6 +16473,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
Generated
+6
@@ -14583,6 +14583,12 @@ public class FirWasmJsCodegenBoxTestGenerated extends AbstractFirWasmJsCodegenBo
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
Generated
+6
@@ -14583,6 +14583,12 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest
|
|||||||
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
runTest("compiler/testData/codegen/box/finally/continueAndOuterFinally.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("decrementInFinally.kt")
|
||||||
|
public void testDecrementInFinally() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/finally/decrementInFinally.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("finallyAndFinally.kt")
|
@TestMetadata("finallyAndFinally.kt")
|
||||||
public void testFinallyAndFinally() throws Exception {
|
public void testFinallyAndFinally() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user