diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/defaultArgsOverridden.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/defaultArgsOverridden.kt index d12ee214bbb..8905bc3d028 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/defaultArgsOverridden.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/defaultArgsOverridden.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF open class A { open fun foo(s: String = "OK") = s @@ -16,4 +17,4 @@ class B : A() { } } -fun box() = B().foo("FAIL") \ No newline at end of file +fun box() = B().foo("FAIL") diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/defaultArgsWithSideEffectsOld.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/defaultArgsWithSideEffectsOld.kt index 7559a02d39e..48b99dd64bf 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/defaultArgsWithSideEffectsOld.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/defaultArgsWithSideEffectsOld.kt @@ -1,5 +1,6 @@ // !LANGUAGE: -ProperComputationOrderOfTailrecDefaultParameters // TARGET_BACKEND: JVM +// IGNORE_FIR_DIAGNOSTICS_DIFF var counter = 0 fun calc(counter: Int) = if (counter % 2 == 0) "K" else "O" @@ -13,4 +14,4 @@ fun calc(counter: Int) = if (counter % 2 == 0) "K" else "O" fun box(): String { return test(0) -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/functionWithNoTails.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/functionWithNoTails.kt index d644b7946bd..d3184b5847a 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/functionWithNoTails.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/functionWithNoTails.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun noTails() { // nothing here @@ -13,4 +14,4 @@ fun box(): String { noTails() return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/functionWithNonTailRecursions.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/functionWithNonTailRecursions.kt index bbd9599efa5..701ab7d03cf 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/functionWithNonTailRecursions.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/functionWithNonTailRecursions.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun badTails(x : Int) : Int { if (x < 50 && x != 10 && x > 0) { @@ -22,4 +23,4 @@ tailrec fun badTails(x : Int) : Int { fun box(): String { badTails(1000000) return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/insideElvis.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/insideElvis.kt index a8edb975f2a..400da7e2d14 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/insideElvis.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/insideElvis.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun test(counter : Int) : Int? { if (counter < 0) return null @@ -15,4 +16,4 @@ tailrec fun test(counter : Int) : Int? { fun box() : String = if (test(100000) == 777) "OK" - else "FAIL" \ No newline at end of file + else "FAIL" diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/labeledThisReferences.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/labeledThisReferences.kt index aa473b7a699..17040b4417d 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/labeledThisReferences.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/labeledThisReferences.kt @@ -7,6 +7,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF class B { inner class C { diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/loops.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/loops.kt index d20eb13a565..5250576fa54 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/loops.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/loops.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun test(x : Int) : Int { var z = if (x > 3) 3 else x @@ -19,4 +20,4 @@ tailrec fun test(x : Int) : Int { return 1 } -fun box() : String = if (test(100000) == 1) "OK" else "FAIL" \ No newline at end of file +fun box() : String = if (test(100000) == 1) "OK" else "FAIL" diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/multilevelBlocks.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/multilevelBlocks.kt index 98bc94c7b8c..273b0226628 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/multilevelBlocks.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/multilevelBlocks.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun test(x : Int) : Int { if (x == 1) { @@ -20,4 +21,4 @@ tailrec fun test(x : Int) : Int { return -1 } -fun box() : String = if (test(1000000) == -1) "OK" else "FAIL" \ No newline at end of file +fun box() : String = if (test(1000000) == -1) "OK" else "FAIL" diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/recursiveCallInLambda.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/recursiveCallInLambda.kt index 5c34734c3ea..edf0ff85c8b 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/recursiveCallInLambda.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/recursiveCallInLambda.kt @@ -7,6 +7,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun foo() { bar { @@ -19,4 +20,4 @@ fun bar(a: Any) {} fun box(): String { foo() return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/recursiveCallInLocalFunction.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/recursiveCallInLocalFunction.kt index a8abe36f076..cc39c8d2332 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/recursiveCallInLocalFunction.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/recursiveCallInLocalFunction.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun foo() { fun bar() { @@ -15,4 +16,4 @@ fun box(): String { foo() return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnIf.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnIf.kt index fe722d7c762..62f50687301 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnIf.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnIf.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun test(x : Int) : Int { return if (x == 1) { @@ -17,4 +18,4 @@ tailrec fun test(x : Int) : Int { } } -fun box() : String = if (test(1000000) == 1) "OK" else "FAIL" \ No newline at end of file +fun box() : String = if (test(1000000) == 1) "OK" else "FAIL" diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnInCatch.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnInCatch.kt index d44861938a7..89a6c01743f 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnInCatch.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnInCatch.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun test(counter : Int) : Int { if (counter == 0) return 0 @@ -16,4 +17,4 @@ } } -fun box() : String = if (test(3) == 0) "OK" else "FAIL" \ No newline at end of file +fun box() : String = if (test(3) == 0) "OK" else "FAIL" diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnInFinally.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnInFinally.kt index 21b8b3ee44b..fe5b34dcf0a 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnInFinally.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnInFinally.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun test(counter : Int) : Int { if (counter == 0) return 0 @@ -16,4 +17,4 @@ } } -fun box() : String = if (test(3) == 0) "OK" else "FAIL" \ No newline at end of file +fun box() : String = if (test(3) == 0) "OK" else "FAIL" diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnInIfInFinally.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnInIfInFinally.kt index b12ca20bb7a..f32b1332912 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnInIfInFinally.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnInIfInFinally.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun test(counter : Int) : Int { if (counter == 0) return 0 @@ -20,4 +21,4 @@ return -1 } -fun box() : String = if (test(3) == 0) "OK" else "FAIL" \ No newline at end of file +fun box() : String = if (test(3) == 0) "OK" else "FAIL" diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnInTry.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnInTry.kt index 4f47b07aaac..592e48a32ca 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnInTry.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/returnInTry.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun test(counter : Int) : Int { if (counter == 0) return 0 @@ -16,4 +17,4 @@ } } -fun box() : String = if (test(3) == 0) "OK" else "FAIL" \ No newline at end of file +fun box() : String = if (test(3) == 0) "OK" else "FAIL" diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/simpleBlock.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/simpleBlock.kt index 05c45c2fd8d..33c5b4f5689 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/simpleBlock.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/simpleBlock.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun test(x : Int) : Int = if (x == 1) { @@ -16,4 +17,4 @@ tailrec fun test(x : Int) : Int = 0 } -fun box() : String = if (test(1000000) == 1) "OK" else "FAIL" \ No newline at end of file +fun box() : String = if (test(1000000) == 1) "OK" else "FAIL" diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/simpleReturn.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/simpleReturn.kt index f4c53d720d0..6b524b593c7 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/simpleReturn.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/simpleReturn.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun test(x : Int) : Int { if (x == 10) { @@ -16,4 +17,4 @@ tailrec fun test(x : Int) : Int { return 0 } -fun box() : String = if (test(1000000) == 1) "OK" else "FAIL" \ No newline at end of file +fun box() : String = if (test(1000000) == 1) "OK" else "FAIL" diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/simpleReturnWithElse.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/simpleReturnWithElse.kt index d2b1a61a49e..8a6e0cb4a7b 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/simpleReturnWithElse.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/simpleReturnWithElse.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun test(x : Int) : Int { if (x == 0) { @@ -17,4 +18,4 @@ tailrec fun test(x : Int) : Int { } } -fun box() : String = if (test(1000000) == 1) "OK" else "FAIL" \ No newline at end of file +fun box() : String = if (test(1000000) == 1) "OK" else "FAIL" diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/tailRecursionInFinally.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/tailRecursionInFinally.kt index 47399a43b4b..7acc3c55016 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/tailRecursionInFinally.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/tailRecursionInFinally.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun test(go: Boolean) : Unit { if (!go) return @@ -20,4 +21,4 @@ fun box(): String { test(true) return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/thisReferences.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/thisReferences.kt index aec5d02a1d0..130cae04858 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/thisReferences.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/thisReferences.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF class A { tailrec fun f1(c : Int) { @@ -28,4 +29,4 @@ fun box() : String { A().f1(1000000) A().f2(1000000) return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/unitBlocks.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/unitBlocks.kt index 51761d0a37a..123c04f7b3e 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/unitBlocks.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/unitBlocks.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun test(x : Int) : Unit { if (x == 1) { @@ -26,4 +27,4 @@ tailrec fun test(x : Int) : Unit { fun box() : String { test(1000000) return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/whenWithCondition.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/whenWithCondition.kt index 2d6806830fd..16aca4d143a 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/whenWithCondition.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/whenWithCondition.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun withWhen(counter : Int) : Int = when (counter) { @@ -13,4 +14,4 @@ tailrec fun withWhen(counter : Int) : Int = else -> withWhen(counter - 1) } -fun box() : String = if (withWhen(100000) == 1) "OK" else "FAIL" \ No newline at end of file +fun box() : String = if (withWhen(100000) == 1) "OK" else "FAIL" diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/whenWithInRange.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/whenWithInRange.kt index 7a158ade975..dbf0e371eab 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/whenWithInRange.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/whenWithInRange.kt @@ -7,6 +7,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun withWhen(counter : Int, d : Any) : Int = when (counter) { @@ -18,4 +19,4 @@ tailrec fun withWhen(counter : Int, d : Any) : Int = else -> withWhen(counter - 1, "else") } -fun box() : String = if (withWhen(100000, "test") == 1) "OK" else "FAIL" \ No newline at end of file +fun box() : String = if (withWhen(100000, "test") == 1) "OK" else "FAIL" diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/whenWithoutCondition.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/whenWithoutCondition.kt index 10546d7038f..8aa3c35752f 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/whenWithoutCondition.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/whenWithoutCondition.kt @@ -5,6 +5,7 @@ // TODO: muted automatically, investigate should it be ran for JS or not // DONT_RUN_GENERATED_CODE: JS // IGNORE_BACKEND: JS +// IGNORE_FIR_DIAGNOSTICS_DIFF tailrec fun withWhen2(counter : Int) : Int = when { @@ -14,4 +15,4 @@ tailrec fun withWhen2(counter : Int) : Int = else -> 1 } -fun box() : String = if (withWhen2(100000) == 1) "OK" else "FAIL" \ No newline at end of file +fun box() : String = if (withWhen2(100000) == 1) "OK" else "FAIL" diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/CodegenTestDirectives.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/CodegenTestDirectives.kt index 98877399fdf..4389040b40d 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/CodegenTestDirectives.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/CodegenTestDirectives.kt @@ -91,6 +91,10 @@ object CodegenTestDirectives : SimpleDirectivesContainer() { description = "Run backend even FIR reported some diagnostics with ERROR severity" ) + val IGNORE_FIR_DIAGNOSTICS_DIFF by directive( + description = "Don't compare diagnostics in testdata for FIR codegen tests" + ) + val DUMP_IR by directive( description = "Dumps generated backend IR (enables ${IrTextDumpHandler::class})" ) diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/FirMetaInfoDiffSuppressor.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/FirMetaInfoDiffSuppressor.kt new file mode 100644 index 00000000000..582a5f52d24 --- /dev/null +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/FirMetaInfoDiffSuppressor.kt @@ -0,0 +1,36 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.test.frontend.fir + +import org.jetbrains.kotlin.test.WrappedException +import org.jetbrains.kotlin.test.directives.CodegenTestDirectives +import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.IGNORE_FIR_DIAGNOSTICS +import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.IGNORE_FIR_DIAGNOSTICS_DIFF +import org.jetbrains.kotlin.test.directives.model.DirectivesContainer +import org.jetbrains.kotlin.test.model.AfterAnalysisChecker +import org.jetbrains.kotlin.test.services.TestServices +import org.jetbrains.kotlin.test.services.moduleStructure + +class FirMetaInfoDiffSuppressor(testServices: TestServices) : AfterAnalysisChecker(testServices) { + override val directives: List + get() = listOf(CodegenTestDirectives) + + override fun suppressIfNeeded(failedAssertions: List): List { + val ignoreErrors = testServices.moduleStructure.modules.any { IGNORE_FIR_DIAGNOSTICS in it.directives } + val ignoreDiff = testServices.moduleStructure.modules.any { IGNORE_FIR_DIAGNOSTICS_DIFF in it.directives } + if (!(ignoreErrors || ignoreDiff)) { + return failedAssertions + } + val filteredAssertions = failedAssertions.filterNot { it is WrappedException.FromMetaInfoHandler } + return if (failedAssertions.size == filteredAssertions.size && ignoreDiff) { + failedAssertions + AssertionError( + "Test contains $IGNORE_FIR_DIAGNOSTICS_DIFF directive but no errors was reported. Please remove directive" + ).wrap() + } else { + filteredAssertions + } + } +} diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractFirBlackBoxCodegenTest.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractFirBlackBoxCodegenTest.kt index 474f14d7768..c4583a27109 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractFirBlackBoxCodegenTest.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/runners/codegen/AbstractFirBlackBoxCodegenTest.kt @@ -9,9 +9,11 @@ import org.jetbrains.kotlin.test.Constructor import org.jetbrains.kotlin.test.TargetBackend import org.jetbrains.kotlin.test.backend.ir.JvmIrBackendFacade import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder +import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.IGNORE_FIR_DIAGNOSTICS_DIFF import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives.USE_PSI_CLASS_FILES_READING import org.jetbrains.kotlin.test.frontend.fir.Fir2IrResultsConverter import org.jetbrains.kotlin.test.frontend.fir.FirFrontendFacade +import org.jetbrains.kotlin.test.frontend.fir.FirMetaInfoDiffSuppressor import org.jetbrains.kotlin.test.frontend.fir.FirOutputArtifact import org.jetbrains.kotlin.test.frontend.fir.handlers.FirCfgDumpHandler import org.jetbrains.kotlin.test.frontend.fir.handlers.FirDumpHandler @@ -45,6 +47,11 @@ open class AbstractFirBlackBoxCodegenTest : AbstractJvmBlackBoxCodegenTestBase>( @@ -25,9 +30,26 @@ abstract class AbstractJvmBlackBoxCodegenTestBase