diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt index 919c6055f33..8e2157d18ca 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt @@ -9,6 +9,7 @@ import com.intellij.openapi.util.io.FileUtil import com.intellij.openapi.util.text.StringUtil import com.intellij.psi.PsiElement import com.intellij.psi.search.GlobalSearchScope +import com.intellij.rt.execution.junit.FileComparisonFailure import junit.framework.AssertionFailedError import junit.framework.TestCase import org.jetbrains.kotlin.TestsCompilerError @@ -281,7 +282,16 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() { } } if (testDataFile.readText().contains("// FIR_IDENTICAL")) { - testRunner.analyzeAndCheckUnhandled(testDataFile, files) + try { + testRunner.analyzeAndCheckUnhandled(testDataFile, files) + } catch (e: FileComparisonFailure) { + println("Old FE & FIR produces different diagnostics for this file. Please remove FIR_IDENTICAL line manually") + throw FileComparisonFailure( + "Old FE & FIR produces different diagnostics for this file. Please remove FIR_IDENTICAL line manually\n" + + e.message, + e.expected, e.actual, e.filePath, e.actualFilePath + ) + } } else { FileUtil.copy(testDataFile, firTestDataFile) testRunner.analyzeAndCheckUnhandled(firTestDataFile, files) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/FirTestUtils.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/FirTestUtils.kt index cb2e652f5a2..9327ca6cc23 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/FirTestUtils.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/FirTestUtils.kt @@ -36,7 +36,9 @@ fun compareAndMergeFirFileAndOldFrontendFile( oldFrontendTestDataFile.writeText("// FIR_IDENTICAL\n" + oldFrontendTestDataFile.readText()) } TestCase.assertFalse( - "Dumps via FIR & via old FE are the same. Deleted .fir.txt dump, added // FIR_IDENTICAL to test source", + "Dumps via FIR & via old FE are the same. " + + "\nDeleted .fir.txt dump, added // FIR_IDENTICAL to test source" + + "\nPlease re-run the test now", sameDumps ) }