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