FIR IDE: ignore not passing highlighting tests

This commit is contained in:
Ilya Kirillov
2020-05-27 13:03:21 +03:00
parent 65b22ebfa9
commit 1b8ea31172
12 changed files with 32 additions and 5 deletions
@@ -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")
}
}
}
+1
View File
@@ -1,3 +1,4 @@
// IGNORE_FIR
// EXPECTED_DUPLICATED_HIGHLIGHTING
<info descr="null" textAttributesKey="KOTLIN_ANNOTATION">@Target</info>(<info descr="null" textAttributesKey="KOTLIN_CLASS">AnnotationTarget</info>.<info descr="null" textAttributesKey="KOTLIN_ENUM_ENTRY">CLASS</info>, <info descr="null" textAttributesKey="KOTLIN_CLASS">AnnotationTarget</info>.<info descr="null" textAttributesKey="KOTLIN_ENUM_ENTRY">EXPRESSION</info>)
+1
View File
@@ -1,3 +1,4 @@
// IGNORE_FIR
// EXPECTED_DUPLICATED_HIGHLIGHTING
<info descr="null">data</info> class <info descr="null">Box</info>(val <info descr="null">v</info>: <info descr="null">Int</info>)
+1
View File
@@ -1,3 +1,4 @@
// IGNORE_FIR
package testing
fun <info textAttributesKey="KOTLIN_FUNCTION_DECLARATION">tst</info>(<info textAttributesKey="KOTLIN_PARAMETER">d</info>: <error><info>dynamic</info></error>) {
+1
View File
@@ -1,3 +1,4 @@
// IGNORE_FIR
package language_injection
<info descr="null">import</info> org.intellij.lang.annotations.<info descr="null">Language</info>
+1
View File
@@ -1,3 +1,4 @@
// IGNORE_FIR
class <info textAttributesKey="KOTLIN_CLASS">My</info>(val <info textAttributesKey="KOTLIN_INSTANCE_PROPERTY">x</info>: <info textAttributesKey="KOTLIN_CLASS">Int</info>?)
fun <info textAttributesKey="KOTLIN_CLASS">My</info>?.<info textAttributesKey="KOTLIN_FUNCTION_DECLARATION">foo</info>(): <info textAttributesKey="KOTLIN_CLASS">Int</info> {
+1
View File
@@ -1,3 +1,4 @@
// IGNORE_FIR
// EXPECTED_DUPLICATED_HIGHLIGHTING
val <info textAttributesKey="KOTLIN_PACKAGE_PROPERTY">fnType</info> : <info textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">suspend</info> () -> <info textAttributesKey="KOTLIN_OBJECT">Unit</info> = {}
@@ -1 +1,2 @@
// IGNORE_FIR
val <info textAttributesKey="KOTLIN_PACKAGE_PROPERTY">weekYear</info> = java.util.<info textAttributesKey="KOTLIN_ABSTRACT_CLASS">Calendar</info>.<info textAttributesKey="KOTLIN_FUNCTION_CALL">getInstance</info>().<info textAttributesKey="KOTLIN_SYNTHETIC_EXTENSION_PROPERTY">weekYear</info>
+1 -1
View File
@@ -1,4 +1,4 @@
// IGNORE_FIR
val <error descr="Destructuring declarations are only allowed for local variables/values">(a, b)</error> by <error descr="[DEBUG] Reference is not resolved to anything, but is not marked unresolved">lazy</error> { <error descr="[DEBUG] Reference is not resolved to anything, but is not marked unresolved">Pair</error>(1, 2) }
val <error descr="Destructuring declarations are only allowed for local variables/values">(c, d)</error> = <error descr="[DEBUG] Reference is not resolved to anything, but is not marked unresolved">run</error> { <error descr="[DEBUG] Reference is not resolved to anything, but is not marked unresolved">Pair</error>(3, 4) }
+1
View File
@@ -1 +1,2 @@
// IGNORE_FIR
<error descr="[WRONG_MODIFIER_TARGET] Modifier 'open' is not applicable to 'top level function'"><info descr="null">open</info></error> <info descr="null">suspend</info> fun <info descr="null">f</info>() {}
+2
View File
@@ -1,3 +1,5 @@
// IGNORE_FIR
@Deprecated(<error>)</error>
fun foo() {}
@Deprecated(<error>false</error>)
@@ -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;
}
}
}
}