From 69059362b85db5fed8f90ce97765396d3c67142c Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 29 Jun 2023 17:59:50 +0200 Subject: [PATCH] Fir2Ir: generate 'finally' block always with Unit type This is important for IR lowerings like PolymorphicSignatureLowering which are very sensitive about the correct types of expressions and placement of coercions to Unit (KT-59218). A boolean parameter to `insertImplicitCasts` is not the best solution to ensure that coercion to Unit is added. The best solution would be to fix the TODO and generate coercion to the block's type for the last statement. But that will affect many other places and will need to be done separately => KT-59781. Code in IrInterpreter is uncommented to fix the FIR test `compiler/testData/ir/interpreter/exceptions/tryFinally.kt`; otherwise evaluation of the function `returnTryFinally` there crashes with "NoSuchElementException: ArrayDeque is empty". No idea why this test didn't fail for K1 though, since the created IR is exactly the same. For some unknown reason this breaks WASM backend with K2, but not with K1 => KT-59800. --- .../fir/backend/Fir2IrImplicitCastInserter.kt | 6 ++--- .../kotlin/fir/backend/Fir2IrVisitor.kt | 24 ++++++++++------- ...LightTreeBlackBoxCodegenTestGenerated.java | 6 +++++ .../FirPsiBlackBoxCodegenTestGenerated.java | 6 +++++ .../kotlin/ir/interpreter/IrInterpreter.kt | 3 +-- .../testData/codegen/box/classes/kt496.kt | 2 ++ .../tryFinallyOfTypeUnit.kt | 9 +++++++ .../ir/irText/expressions/tryCatch.fir.ir.txt | 27 ------------------- .../ir/irText/expressions/tryCatch.fir.kt.txt | 27 ------------------- .../ir/irText/expressions/tryCatch.kt | 1 + .../codegen/BlackBoxCodegenTestGenerated.java | 6 +++++ .../IrBlackBoxCodegenTestGenerated.java | 6 +++++ ...kBoxCodegenWithIrInlinerTestGenerated.java | 6 +++++ .../LightAnalysisModeTestGenerated.java | 5 ++++ .../fir/FirJsCodegenBoxTestGenerated.java | 6 +++++ .../test/ir/IrJsCodegenBoxTestGenerated.java | 6 +++++ .../ir/IrJsES6CodegenBoxTestGenerated.java | 6 +++++ .../FirNativeCodegenBoxTestGenerated.java | 6 +++++ .../FirNativeCodegenBoxTestNoPLGenerated.java | 6 +++++ .../NativeCodegenBoxTestGenerated.java | 6 +++++ .../NativeCodegenBoxTestNoPLGenerated.java | 6 +++++ .../test/FirWasmCodegenBoxTestGenerated.java | 6 +++++ .../test/K1WasmCodegenBoxTestGenerated.java | 6 +++++ 23 files changed, 119 insertions(+), 69 deletions(-) create mode 100644 compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt delete mode 100644 compiler/testData/ir/irText/expressions/tryCatch.fir.ir.txt delete mode 100644 compiler/testData/ir/irText/expressions/tryCatch.fir.kt.txt diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrImplicitCastInserter.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrImplicitCastInserter.kt index 6ebd581697a..024e19bf113 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrImplicitCastInserter.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrImplicitCastInserter.kt @@ -173,7 +173,7 @@ class Fir2IrImplicitCastInserter( override fun visitTryExpression(tryExpression: FirTryExpression, data: IrElement): IrElement { val irTry = data as IrTry (irTry.finallyExpression as? IrContainerExpression)?.let { - irTry.finallyExpression = it.insertImplicitCasts() + irTry.finallyExpression = it.insertImplicitCasts(coerceLastExpressionToUnit = true) } return data } @@ -237,13 +237,13 @@ class Fir2IrImplicitCastInserter( return implicitNotNullCast(this) } - private fun IrContainerExpression.insertImplicitCasts(): IrContainerExpression { + private fun IrContainerExpression.insertImplicitCasts(coerceLastExpressionToUnit: Boolean = false): IrContainerExpression { if (statements.isEmpty()) return this val lastIndex = statements.lastIndex statements.forEachIndexed { i, irStatement -> if (irStatement !is IrErrorCallExpression && irStatement is IrExpression) { - if (i != lastIndex) { + if (i != lastIndex || coerceLastExpressionToUnit) { statements[i] = coerceToUnitIfNeeded(irStatement, irBuiltIns) } // TODO: for the last statement, need to cast to the return type if mismatched diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt index 15ab6a243d8..d7600b0a0be 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt @@ -957,13 +957,13 @@ class Fir2IrVisitor( return statements.convertToIrExpressionOrBlock(source, origin) } - private fun FirBlock.convertToIrBlock(origin: IrStatementOrigin? = null): IrExpression { - return statements.convertToIrBlock(source, origin) + private fun FirBlock.convertToIrBlock(forceUnitType: Boolean): IrExpression { + return statements.convertToIrBlock(source, null, forceUnitType) } private fun List.convertToIrExpressionOrBlock( source: KtSourceElement?, - origin: IrStatementOrigin? = null + origin: IrStatementOrigin? ): IrExpression { if (size == 1) { val firStatement = single() @@ -973,14 +973,15 @@ class Fir2IrVisitor( return convertToIrExpression(firStatement) } } - return convertToIrBlock(source, origin) + return convertToIrBlock(source, origin, forceUnitType = origin?.isLoop == true) } private fun List.convertToIrBlock( source: KtSourceElement?, - origin: IrStatementOrigin? = null + origin: IrStatementOrigin?, + forceUnitType: Boolean, ): IrExpression { - val type = if (origin?.isLoop == true) + val type = if (forceUnitType) irBuiltIns.unitType else (lastOrNull() as? FirExpression)?.typeRef?.toIrType() ?: irBuiltIns.unitType @@ -1230,7 +1231,8 @@ class Fir2IrVisitor( innerEndOffset, irBuiltIns.unitType, origin, - loopVariables + loopBodyStatements.drop(loopVariableIndex).convertToIrExpressionOrBlock(firLoopBody.source) + loopVariables + + loopBodyStatements.drop(loopVariableIndex).convertToIrExpressionOrBlock(firLoopBody.source, null) ) } } else { @@ -1286,10 +1288,12 @@ class Fir2IrVisitor( return tryExpression.convertWithOffsets { startOffset, endOffset -> IrTryImpl( startOffset, endOffset, tryExpression.typeRef.toIrType(), - tryExpression.tryBlock.convertToIrBlock(), + tryExpression.tryBlock.convertToIrBlock(forceUnitType = false), tryExpression.catches.map { it.accept(this, data) as IrCatch }, - tryExpression.finallyBlock?.convertToIrBlock() + tryExpression.finallyBlock?.convertToIrBlock(forceUnitType = true) ) + }.also { + tryExpression.accept(implicitCastInserter, it) } } @@ -1298,7 +1302,7 @@ class Fir2IrVisitor( val catchParameter = declarationStorage.createIrVariable( catch.parameter, conversionScope.parentFromStack(), IrDeclarationOrigin.CATCH_PARAMETER ) - IrCatchImpl(startOffset, endOffset, catchParameter, catch.block.convertToIrBlock()) + IrCatchImpl(startOffset, endOffset, catchParameter, catch.block.convertToIrBlock(forceUnitType = false)) } } diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java index d40c83c9e57..20e8e32d9aa 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java @@ -10090,6 +10090,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryCatchAfterWhileTrue.kt"); } + @Test + @TestMetadata("tryFinallyOfTypeUnit.kt") + public void testTryFinallyOfTypeUnit() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt"); + } + @Test @TestMetadata("tryInsideCatch.kt") public void testTryInsideCatch() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java index 2354d51e146..6583ac8e868 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java @@ -10090,6 +10090,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryCatchAfterWhileTrue.kt"); } + @Test + @TestMetadata("tryFinallyOfTypeUnit.kt") + public void testTryFinallyOfTypeUnit() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt"); + } + @Test @TestMetadata("tryInsideCatch.kt") public void testTryInsideCatch() throws Exception { diff --git a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/IrInterpreter.kt b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/IrInterpreter.kt index 653b6ac5743..baaecafcb6f 100644 --- a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/IrInterpreter.kt +++ b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/IrInterpreter.kt @@ -414,8 +414,7 @@ class IrInterpreter(internal val environment: IrInterpreterEnvironment, internal val state = callStack.popState() when (expression.operator) { IrTypeOperator.IMPLICIT_COERCION_TO_UNIT -> { - // do nothing - // callStack.pushState(getUnitState()) TODO find real use cases for this + callStack.pushState(getUnitState()) } IrTypeOperator.CAST, IrTypeOperator.IMPLICIT_CAST -> { when { diff --git a/compiler/testData/codegen/box/classes/kt496.kt b/compiler/testData/codegen/box/classes/kt496.kt index 38489ea9cd1..84f12258dae 100644 --- a/compiler/testData/codegen/box/classes/kt496.kt +++ b/compiler/testData/codegen/box/classes/kt496.kt @@ -1,3 +1,5 @@ +// IGNORE_BACKEND_K2: WASM +// ^ KT-59800 K2 + Wasm: test failure after changing `finally` block generation fun test1() : Boolean { try { diff --git a/compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt b/compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt new file mode 100644 index 00000000000..c8eeff72379 --- /dev/null +++ b/compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt @@ -0,0 +1,9 @@ +fun check(value: Any?) { + if (value != Unit) throw AssertionError("Fail: $value") +} + +fun box(): String { + val x = 10 + check(try { } catch (e: Exception) { } finally { x }) + return "OK" +} diff --git a/compiler/testData/ir/irText/expressions/tryCatch.fir.ir.txt b/compiler/testData/ir/irText/expressions/tryCatch.fir.ir.txt deleted file mode 100644 index 3536fe2c18f..00000000000 --- a/compiler/testData/ir/irText/expressions/tryCatch.fir.ir.txt +++ /dev/null @@ -1,27 +0,0 @@ -FILE fqName: fileName:/tryCatch.kt - FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - TRY type=kotlin.Unit - try: BLOCK type=kotlin.Unit origin=null - CALL 'public final fun println (): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null - CATCH parameter=val e: kotlin.Throwable declared in .test1 - VAR CATCH_PARAMETER name:e type:kotlin.Throwable [val] - BLOCK type=kotlin.Unit origin=null - CALL 'public final fun println (): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null - finally: BLOCK type=kotlin.Unit origin=null - CALL 'public final fun println (): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null - FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Int - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun test2 (): kotlin.Int declared in ' - TRY type=kotlin.Int - try: BLOCK type=kotlin.Int origin=null - CALL 'public final fun println (): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null - CONST Int type=kotlin.Int value=42 - CATCH parameter=val e: kotlin.Throwable declared in .test2 - VAR CATCH_PARAMETER name:e type:kotlin.Throwable [val] - BLOCK type=kotlin.Int origin=null - CALL 'public final fun println (): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null - CONST Int type=kotlin.Int value=24 - finally: BLOCK type=kotlin.Int origin=null - CALL 'public final fun println (): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null - CONST Int type=kotlin.Int value=555 diff --git a/compiler/testData/ir/irText/expressions/tryCatch.fir.kt.txt b/compiler/testData/ir/irText/expressions/tryCatch.fir.kt.txt deleted file mode 100644 index 236b2363c00..00000000000 --- a/compiler/testData/ir/irText/expressions/tryCatch.fir.kt.txt +++ /dev/null @@ -1,27 +0,0 @@ -fun test1() { - try { // BLOCK - println() - } - catch (e: Throwable){ // BLOCK - println() - } - finally { // BLOCK - println() - } -} - -fun test2(): Int { - return try { // BLOCK - println() - 42 - } - catch (e: Throwable){ // BLOCK - println() - 24 - } - finally { // BLOCK - println() - 555 - } -} - diff --git a/compiler/testData/ir/irText/expressions/tryCatch.kt b/compiler/testData/ir/irText/expressions/tryCatch.kt index 310e1be6e50..6529c1a635d 100644 --- a/compiler/testData/ir/irText/expressions/tryCatch.kt +++ b/compiler/testData/ir/irText/expressions/tryCatch.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // WITH_STDLIB fun test1() { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index d8f39179db4..0293367243d 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -9832,6 +9832,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryCatchAfterWhileTrue.kt"); } + @Test + @TestMetadata("tryFinallyOfTypeUnit.kt") + public void testTryFinallyOfTypeUnit() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt"); + } + @Test @TestMetadata("tryInsideCatch.kt") public void testTryInsideCatch() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index aa9996e60ee..0409b57d881 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -10090,6 +10090,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryCatchAfterWhileTrue.kt"); } + @Test + @TestMetadata("tryFinallyOfTypeUnit.kt") + public void testTryFinallyOfTypeUnit() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt"); + } + @Test @TestMetadata("tryInsideCatch.kt") public void testTryInsideCatch() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java index 6f09d6267f2..0f040869467 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java @@ -10090,6 +10090,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryCatchAfterWhileTrue.kt"); } + @Test + @TestMetadata("tryFinallyOfTypeUnit.kt") + public void testTryFinallyOfTypeUnit() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt"); + } + @Test @TestMetadata("tryInsideCatch.kt") public void testTryInsideCatch() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 4781e80b662..03f5e7a2ea6 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -7938,6 +7938,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryCatchAfterWhileTrue.kt"); } + @TestMetadata("tryFinallyOfTypeUnit.kt") + public void testTryFinallyOfTypeUnit() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt"); + } + @TestMetadata("tryInsideCatch.kt") public void testTryInsideCatch() throws Exception { runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryInsideCatch.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java index 1ef1da332dc..8061f91cd0c 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java @@ -6910,6 +6910,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryCatchAfterWhileTrue.kt"); } + @Test + @TestMetadata("tryFinallyOfTypeUnit.kt") + public void testTryFinallyOfTypeUnit() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt"); + } + @Test @TestMetadata("tryInsideCatch.kt") public void testTryInsideCatch() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index 400cc07f719..cafa32e03c9 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -6910,6 +6910,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryCatchAfterWhileTrue.kt"); } + @Test + @TestMetadata("tryFinallyOfTypeUnit.kt") + public void testTryFinallyOfTypeUnit() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt"); + } + @Test @TestMetadata("tryInsideCatch.kt") public void testTryInsideCatch() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java index 39801d2f3b8..8a5348850cf 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java @@ -6910,6 +6910,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryCatchAfterWhileTrue.kt"); } + @Test + @TestMetadata("tryFinallyOfTypeUnit.kt") + public void testTryFinallyOfTypeUnit() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt"); + } + @Test @TestMetadata("tryInsideCatch.kt") public void testTryInsideCatch() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java index 9172f27d76f..36d70b5ea20 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestGenerated.java @@ -7755,6 +7755,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryCatchAfterWhileTrue.kt"); } + @Test + @TestMetadata("tryFinallyOfTypeUnit.kt") + public void testTryFinallyOfTypeUnit() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt"); + } + @Test @TestMetadata("tryInsideCatch.kt") public void testTryInsideCatch() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java index 5c289f7a98b..2c8770c6b5a 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/FirNativeCodegenBoxTestNoPLGenerated.java @@ -7929,6 +7929,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryCatchAfterWhileTrue.kt"); } + @Test + @TestMetadata("tryFinallyOfTypeUnit.kt") + public void testTryFinallyOfTypeUnit() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt"); + } + @Test @TestMetadata("tryInsideCatch.kt") public void testTryInsideCatch() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java index bd033240a28..6991e19e088 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java @@ -7669,6 +7669,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryCatchAfterWhileTrue.kt"); } + @Test + @TestMetadata("tryFinallyOfTypeUnit.kt") + public void testTryFinallyOfTypeUnit() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt"); + } + @Test @TestMetadata("tryInsideCatch.kt") public void testTryInsideCatch() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java index bb11add585c..1b78fed083e 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestNoPLGenerated.java @@ -7756,6 +7756,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryCatchAfterWhileTrue.kt"); } + @Test + @TestMetadata("tryFinallyOfTypeUnit.kt") + public void testTryFinallyOfTypeUnit() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt"); + } + @Test @TestMetadata("tryInsideCatch.kt") public void testTryInsideCatch() throws Exception { diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java index 990822430d5..9aa427d914a 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java @@ -6886,6 +6886,12 @@ public class FirWasmCodegenBoxTestGenerated extends AbstractFirWasmCodegenBoxTes runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryCatchAfterWhileTrue.kt"); } + @Test + @TestMetadata("tryFinallyOfTypeUnit.kt") + public void testTryFinallyOfTypeUnit() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt"); + } + @Test @TestMetadata("tryInsideCatch.kt") public void testTryInsideCatch() throws Exception { diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java index a6c1e24c668..1af4b86a8ea 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java @@ -6886,6 +6886,12 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryCatchAfterWhileTrue.kt"); } + @Test + @TestMetadata("tryFinallyOfTypeUnit.kt") + public void testTryFinallyOfTypeUnit() throws Exception { + runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/tryFinallyOfTypeUnit.kt"); + } + @Test @TestMetadata("tryInsideCatch.kt") public void testTryInsideCatch() throws Exception {