From 89ecd1e0e27a34dd1fc39d3c0790bc797fb7deae Mon Sep 17 00:00:00 2001 From: Sergej Jaskiewicz Date: Mon, 1 May 2023 17:59:41 +0200 Subject: [PATCH] [FIR] Respect exception suppression in Fir2IrResultsConverter Only Fir2IrJvmResultsConverter respected the IGNORE_FIR2IR_EXCEPTIONS_IF_FIR_CONTAINS_ERRORS test directive. Fir2IrJsResultConverter didn't. This is fixed here. --- .../test/frontend/fir/Fir2IrJsResultsConverter.kt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/Fir2IrJsResultsConverter.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/Fir2IrJsResultsConverter.kt index 4f1367bcf73..de81fdfbff2 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/Fir2IrJsResultsConverter.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/Fir2IrJsResultsConverter.kt @@ -41,6 +41,7 @@ import org.jetbrains.kotlin.library.metadata.resolver.KotlinResolvedLibrary import org.jetbrains.kotlin.library.unresolvedDependencies import org.jetbrains.kotlin.storage.LockBasedStorageManager import org.jetbrains.kotlin.test.backend.ir.IrBackendInput +import org.jetbrains.kotlin.test.directives.CodegenTestDirectives import org.jetbrains.kotlin.test.model.BackendKinds import org.jetbrains.kotlin.test.model.Frontend2BackendConverter import org.jetbrains.kotlin.test.model.FrontendKinds @@ -55,7 +56,19 @@ class Fir2IrJsResultsConverter( FrontendKinds.FIR, BackendKinds.IrBackend ) { - override fun transform( + + override fun transform(module: TestModule, inputArtifact: FirOutputArtifact): IrBackendInput? = + try { + transformInternal(module, inputArtifact) + } catch (e: Throwable) { + if (CodegenTestDirectives.IGNORE_FIR2IR_EXCEPTIONS_IF_FIR_CONTAINS_ERRORS in module.directives && inputArtifact.hasErrors) { + null + } else { + throw e + } + } + + private fun transformInternal( module: TestModule, inputArtifact: FirOutputArtifact ): IrBackendInput {