diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/AbstractFirHighlightingTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/AbstractFirHighlightingTest.kt
index 0f240cd73cf..03e6cdfdf95 100644
--- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/AbstractFirHighlightingTest.kt
+++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/highlighter/AbstractFirHighlightingTest.kt
@@ -14,9 +14,18 @@ abstract class AbstractFirHighlightingTest : AbstractHighlightingTest() {
override fun isFirPlugin() = true
override fun checkHighlighting(fileText: String) {
+ val doComparison = !InTextDirectivesUtils.isDirectiveDefined(myFixture.file.text, "IGNORE_FIR")
val checkInfos = !InTextDirectivesUtils.isDirectiveDefined(fileText, NO_CHECK_INFOS_PREFIX);
- // warnings are not supported yet
- myFixture.checkHighlighting(/* checkWarnings= */ false, checkInfos, /* checkWeakWarnings= */ false)
+ try {
+ // warnings are not supported yet
+ myFixture.checkHighlighting(/* checkWarnings= */ false, checkInfos, /* checkWeakWarnings= */ false)
+ } catch (e: Throwable) {
+ if (doComparison) throw e
+ return
+ }
+ if (!doComparison) {
+ throw AssertionError("Looks like test is passing, please remove IGNORE_FIR")
+ }
}
}
\ No newline at end of file
diff --git a/idea/testData/highlighter/Annotations.kt b/idea/testData/highlighter/Annotations.kt
index ad5c4c03ce7..a088ba160aa 100644
--- a/idea/testData/highlighter/Annotations.kt
+++ b/idea/testData/highlighter/Annotations.kt
@@ -1,3 +1,4 @@
+// IGNORE_FIR
// EXPECTED_DUPLICATED_HIGHLIGHTING
@Target(AnnotationTarget.CLASS, AnnotationTarget.EXPRESSION)
diff --git a/idea/testData/highlighter/Destructuring.kt b/idea/testData/highlighter/Destructuring.kt
index b35277cccdb..e8f2f70a1e3 100644
--- a/idea/testData/highlighter/Destructuring.kt
+++ b/idea/testData/highlighter/Destructuring.kt
@@ -1,3 +1,4 @@
+// IGNORE_FIR
// EXPECTED_DUPLICATED_HIGHLIGHTING
data class Box(val v: Int)
diff --git a/idea/testData/highlighter/Dynamic.kt b/idea/testData/highlighter/Dynamic.kt
index afa757c84f8..54374177aa0 100644
--- a/idea/testData/highlighter/Dynamic.kt
+++ b/idea/testData/highlighter/Dynamic.kt
@@ -1,3 +1,4 @@
+// IGNORE_FIR
package testing
fun tst(d: dynamic) {
diff --git a/idea/testData/highlighter/KotlinInjection.kt b/idea/testData/highlighter/KotlinInjection.kt
index 2ad0bbb4f30..108b21ffea7 100644
--- a/idea/testData/highlighter/KotlinInjection.kt
+++ b/idea/testData/highlighter/KotlinInjection.kt
@@ -1,3 +1,4 @@
+// IGNORE_FIR
package language_injection
import org.intellij.lang.annotations.Language
diff --git a/idea/testData/highlighter/SmartCast.kt b/idea/testData/highlighter/SmartCast.kt
index 1b4619435d3..e632da42401 100644
--- a/idea/testData/highlighter/SmartCast.kt
+++ b/idea/testData/highlighter/SmartCast.kt
@@ -1,3 +1,4 @@
+// IGNORE_FIR
class My(val x: Int?)
fun My?.foo(): Int {
diff --git a/idea/testData/highlighter/Suspend.kt b/idea/testData/highlighter/Suspend.kt
index 617825f966c..474b24e9aa1 100644
--- a/idea/testData/highlighter/Suspend.kt
+++ b/idea/testData/highlighter/Suspend.kt
@@ -1,3 +1,4 @@
+// IGNORE_FIR
// EXPECTED_DUPLICATED_HIGHLIGHTING
val fnType : suspend () -> Unit = {}
diff --git a/idea/testData/highlighter/SyntheticExtensionProperty.kt b/idea/testData/highlighter/SyntheticExtensionProperty.kt
index a5b4bd98dad..22fb9ac6c5a 100644
--- a/idea/testData/highlighter/SyntheticExtensionProperty.kt
+++ b/idea/testData/highlighter/SyntheticExtensionProperty.kt
@@ -1 +1,2 @@
+// IGNORE_FIR
val weekYear = java.util.Calendar.getInstance().weekYear
\ No newline at end of file
diff --git a/idea/testData/highlighter/TopLevelDestructuring.kt b/idea/testData/highlighter/TopLevelDestructuring.kt
index 8d4b9c41f5a..a27ac6e3214 100644
--- a/idea/testData/highlighter/TopLevelDestructuring.kt
+++ b/idea/testData/highlighter/TopLevelDestructuring.kt
@@ -1,4 +1,4 @@
-
+// IGNORE_FIR
val (a, b) by lazy { Pair(1, 2) }
val (c, d) = run { Pair(3, 4) }
diff --git a/idea/testData/highlighter/TopLevelOpenSuspendFun.kt b/idea/testData/highlighter/TopLevelOpenSuspendFun.kt
index 8d43e4a5661..8713c9611bb 100644
--- a/idea/testData/highlighter/TopLevelOpenSuspendFun.kt
+++ b/idea/testData/highlighter/TopLevelOpenSuspendFun.kt
@@ -1 +1,2 @@
+// IGNORE_FIR
open suspend fun f() {}
\ No newline at end of file
diff --git a/idea/testData/highlighter/deprecated/Invalid.kt b/idea/testData/highlighter/deprecated/Invalid.kt
index b1d714035c2..be7a984a253 100644
--- a/idea/testData/highlighter/deprecated/Invalid.kt
+++ b/idea/testData/highlighter/deprecated/Invalid.kt
@@ -1,3 +1,5 @@
+// IGNORE_FIR
+
@Deprecated()
fun foo() {}
@Deprecated(false)
diff --git a/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractHighlightingTest.java b/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractHighlightingTest.java
index 40d6ff01af9..e8f68fe4340 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractHighlightingTest.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractHighlightingTest.java
@@ -54,12 +54,20 @@ public abstract class AbstractHighlightingTest extends KotlinLightCodeInsightFix
});
}
- private static void withExpectedDuplicatedHighlighting(boolean expectedDuplicatedHighlighting, Runnable runnable) {
+ private void withExpectedDuplicatedHighlighting(boolean expectedDuplicatedHighlighting, Runnable runnable) {
if (!expectedDuplicatedHighlighting) {
runnable.run();
return;
}
- ExpectedHighlightingData.expectedDuplicatedHighlighting(runnable);
+ try {
+ ExpectedHighlightingData.expectedDuplicatedHighlighting(runnable);
+ } catch (IllegalStateException e) {
+ if (isFirPlugin()) {
+ runnable.run();
+ } else {
+ throw e;
+ }
+ }
}
}