FIR IDE: fix test data in fir-ide module
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
// FIR_COMPARISON
|
||||
class A {
|
||||
fun f() : A
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// FIR_COMPARISON
|
||||
object A {
|
||||
fun f() : S
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
package org.jetbrains.kotlin.checkers
|
||||
|
||||
import com.intellij.rt.execution.junit.FileComparisonFailure
|
||||
import org.jetbrains.kotlin.idea.completion.FIR_COMPARISON
|
||||
import org.jetbrains.kotlin.idea.completion.runTestWithCustomEnableDirective
|
||||
import org.jetbrains.kotlin.idea.test.withCustomCompilerOptions
|
||||
import org.jetbrains.kotlin.idea.withPossiblyDisabledDuplicatedFirSourceElementsException
|
||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||
@@ -16,13 +18,11 @@ abstract class AbstractFirPsiCheckerTest : AbstractPsiCheckerTest() {
|
||||
|
||||
override fun isFirPlugin(): Boolean = true
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
}
|
||||
|
||||
override fun doTest(filePath: String) {
|
||||
myFixture.configureByFile(fileName())
|
||||
checkHighlighting(checkWarnings = false, checkInfos = false, checkWeakWarnings = false)
|
||||
runTestWithCustomEnableDirective(FIR_COMPARISON, testDataFile()) {
|
||||
myFixture.configureByFile(fileName())
|
||||
checkHighlighting(checkWarnings = false, checkInfos = false, checkWeakWarnings = false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun checkHighlighting(
|
||||
@@ -30,27 +30,15 @@ abstract class AbstractFirPsiCheckerTest : AbstractPsiCheckerTest() {
|
||||
checkInfos: Boolean,
|
||||
checkWeakWarnings: Boolean
|
||||
): Long {
|
||||
val file = file
|
||||
val fileText = file.text
|
||||
return withCustomCompilerOptions(fileText, project, module) {
|
||||
val doComparison = InTextDirectivesUtils.isDirectiveDefined(myFixture.file.text, "FIR_COMPARISON")
|
||||
try {
|
||||
withPossiblyDisabledDuplicatedFirSourceElementsException(fileText) {
|
||||
myFixture.checkHighlighting(checkWarnings, checkInfos, checkWeakWarnings)
|
||||
}
|
||||
} catch (e: FileComparisonFailure) {
|
||||
if (doComparison) {
|
||||
// Even this is very partial check (only error compatibility, no warnings / infos)
|
||||
throw FileComparisonFailure(e.message, e.expected, e.actual, File(e.filePath).absolutePath)
|
||||
} else {
|
||||
// Here we just check that we haven't crashed due to exception
|
||||
0
|
||||
}
|
||||
throw FileComparisonFailure(e.message, e.expected, e.actual, File(e.filePath).absolutePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun tearDown() {
|
||||
super.tearDown()
|
||||
}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_COMPARISON
|
||||
enum class E {
|
||||
ENTRY;
|
||||
|
||||
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_COMPARISON
|
||||
fun test() {
|
||||
val a : Int? = 0
|
||||
if (a != null) {
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// IGNORE_FIR
|
||||
// !DIAGNOSTICS: -DUPLICATE_CLASS_NAMES
|
||||
val <error>a</error> : Int = 1
|
||||
val <error>a</error> : Int = 1
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_FIR
|
||||
// KT-286 Check supertype lists
|
||||
|
||||
/*
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
// IGNORE_FIR
|
||||
|
||||
open class bar()
|
||||
|
||||
interface Foo<error>()</error> : <error>bar</error><error>()</error>, <error><error>bar</error></error>, <error><error>bar</error></error> {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_COMPARISON
|
||||
<info>import</info> kotlin.reflect.KProperty
|
||||
|
||||
interface T
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_COMPARISON
|
||||
<info descr="null">inline</info> fun <T> run(f: () -> T) = f()
|
||||
fun run2(f: () -> Unit) = f()
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_COMPARISON
|
||||
interface IA
|
||||
interface IB
|
||||
interface IC
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_COMPARISON
|
||||
interface IA
|
||||
interface IB
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_COMPARISON
|
||||
class B {
|
||||
class Builder
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_FIR
|
||||
|
||||
class C {
|
||||
<error>fun ()</error> {
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_FIR
|
||||
|
||||
package<EOLError></EOLError>
|
||||
|
||||
<error>fun ()</error> {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_COMPARISON
|
||||
// One of the two passes is making a scope and turning vals into functions
|
||||
// See KT-76
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// FIR_COMPARISON
|
||||
|
||||
data class XY(val x: Int, val y: Int)
|
||||
|
||||
fun convert(xy: XY, f: (XY) -> Int) = f(xy)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_COMPARISON
|
||||
package foo
|
||||
|
||||
@<error>Anno</error> ({ val x: Int })
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_COMPARISON
|
||||
package jet121
|
||||
|
||||
fun box(): String {
|
||||
|
||||
-2
@@ -1,5 +1,3 @@
|
||||
// FIR_COMPARISON
|
||||
|
||||
import java.util.Collections
|
||||
|
||||
fun <T> checkSubtype(t: T) = t
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_COMPARISON
|
||||
fun f() {
|
||||
val g = 3
|
||||
<error>g</error>(object : Any() {})
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// FIR_COMPARISON
|
||||
|
||||
interface Bar {
|
||||
fun <T> T.bar() {}
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -1,5 +1,6 @@
|
||||
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtNamedFunction
|
||||
// OPTIONS: usages, skipImports
|
||||
// FIR_COMPARISON
|
||||
package server
|
||||
|
||||
interface TraitWithImpl {
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
// IGNORE_FIR
|
||||
|
||||
<info textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">open</info> class <info textAttributesKey="KOTLIN_CLASS">Foo</info> {
|
||||
<info textAttributesKey="KOTLIN_KEYWORD">constructor</info>(<warning descr="[UNUSED_PARAMETER] Parameter 'i' is never used" textAttributesKey="NOT_USED_ELEMENT_ATTRIBUTES"><info textAttributesKey="KOTLIN_PARAMETER">i</info></warning>: <info textAttributesKey="KOTLIN_CLASS">Int</info>)
|
||||
}
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// IGNORE_FIR
|
||||
// EXPECTED_DUPLICATED_HIGHLIGHTING
|
||||
|
||||
typealias <info textAttributesKey="KOTLIN_TYPE_ALIAS">Predicate</info><<info textAttributesKey="KOTLIN_TYPE_PARAMETER">T</info>> = (<info textAttributesKey="KOTLIN_TYPE_PARAMETER">T</info>) -> <info textAttributesKey="KOTLIN_CLASS">Boolean</info>
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// IGNORE_FIR
|
||||
// EXPECTED_DUPLICATED_HIGHLIGHTING
|
||||
|
||||
var <info textAttributesKey="KOTLIN_MUTABLE_VARIABLE"><info textAttributesKey="KOTLIN_PACKAGE_PROPERTY">x</info></info> = 5
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// IGNORE_FIR
|
||||
|
||||
package test
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_FIR
|
||||
package t
|
||||
|
||||
class A {
|
||||
|
||||
Reference in New Issue
Block a user