[FIR] Add diagnostics reporting to FIR resolve tests

This commit is contained in:
Dmitriy Novozhilov
2019-10-31 16:16:38 +03:00
parent 38bb9f78d6
commit 65eed24dbb
44 changed files with 324 additions and 363 deletions
@@ -14,7 +14,7 @@ import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.Name
class FirUnresolvedReferenceError(val name: Name? = null) : FirDiagnostic() {
override val reason: String get() = "Unresolved reference" + (name?.asString() ?: "")
override val reason: String get() = "Unresolved reference" + if (name != null) ": ${name.asString()}" else ""
}
class FirUnresolvedSymbolError(val classId: ClassId) : FirDiagnostic() {
+4 -4
View File
@@ -8,19 +8,19 @@ fun test() {
foo(1, 2.0, true)
foo(1, third = true)
foo()
foo(0, 0.0, false, "")
<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>()<!>
<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>(0, 0.0, false, "")<!>
bar(1, third = true)
bar(1, 2.0, true)
bar(1, 2.0, true, "my")
bar(1, true)
<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>bar<!>(1, true)<!>
baz(1)
baz(1, "my", "yours")
baz(1, z = true)
baz(0, "", false)
<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>baz<!>(0, "", false)<!>
}
+7 -7
View File
@@ -8,21 +8,21 @@ fun test() {
foo() {}
foo({})
foo(1) {}
foo(f = {}) {}
<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>(1) {}<!>
<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>(f = {}) {}<!>
bar(1) {}
bar(x = 1) {}
bar(1, {})
bar(x = 1, f = {})
bar {}
bar({})
<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>bar<!> {}<!>
<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>bar<!>({})<!>
baz(other = false, f = {})
baz({}, false)
baz {}
baz() {}
baz(other = false) {}
<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>baz<!> {}<!>
<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>baz<!>() {}<!>
<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>baz<!>(other = false) {}<!>
}
+7 -7
View File
@@ -7,11 +7,11 @@ fun test() {
foo(1, second = 3.14, third = false, fourth = "!?")
foo(third = false, second = 2.71, fourth = "?!", first = 0)
foo()
foo(0.0, false, 0, "")
foo(1, 2.0, third = true, "")
foo(second = 0.0, first = 0, fourth = "")
foo(first = 0.0, second = 0, third = "", fourth = false)
foo(first = 0, second = 0.0, third = false, fourth = "", first = 1)
foo(0, 0.0, false, foth = "")
<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>()<!>
<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>(0.0, false, 0, "")<!>
<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>(1, 2.0, third = true, "")<!>
<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>(second = 0.0, first = 0, fourth = "")<!>
<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>(first = 0.0, second = 0, third = "", fourth = false)<!>
<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>(first = 0, second = 0.0, third = false, fourth = "", first = 1)<!>
<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>(0, 0.0, false, foth = "")<!>
}
+4 -4
View File
@@ -7,11 +7,11 @@ fun test() {
foo(1, "my", "yours")
foo(1, *arrayOf("my", "yours"))
foo("")
foo(1, 2)
<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>("")<!>
<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>(1, 2)<!>
bar(1, z = true, y = *arrayOf("my", "yours"))
bar(0, z = false, y = "", y = "other")
bar(0, "", true)
<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>bar<!>(0, z = false, y = "", y = "other")<!>
<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>bar<!>(0, "", true)<!>
}
+6 -6
View File
@@ -1,15 +1,15 @@
@Throws(IOException::class, ResponseParseException::class)
@Throws(<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>IOException<!>::class, <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>ResponseParseException<!>::class)
fun fetchPluginReleaseDate(pluginId: PluginId, version: String, channel: String?): LocalDate? {
val url = "https://plugins.jetbrains.com/api/plugins/${pluginId.idString}/updates?version=$version"
val url = "https://plugins.jetbrains.com/api/plugins/${pluginId.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>idString<!>}/updates?version=$version"
val pluginDTOs: Array<PluginDTO> = try {
HttpRequests.request(url).connect {
<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>HttpRequests<!>.<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>request<!>(url)<!>.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>connect<!> {
GsonBuilder().create().fromJson(it.inputStream.reader(), Array<PluginDTO>::class.java)
}
}<!>
} catch (ioException: JsonIOException) {
throw IOException(ioException)
throw <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>IOException<!>(ioException)<!>
} catch (syntaxException: JsonSyntaxException) {
throw ResponseParseException("Can't parse json response", syntaxException)
throw <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>ResponseParseException<!>("Can't parse json response", syntaxException)<!>
}
}
+1 -1
View File
@@ -13,7 +13,7 @@ fun test_2(x: Int?) {
} else {
x
}
y.inc()
y.<!AMBIGUITY, AMBIGUITY!><!AMBIGUITY!>inc<!>()<!>
}
fun test_3(x: Int?) {
@@ -21,7 +21,7 @@ class Bar {
}
// NB! abc() here is resolved to member Foo.abc(), and not to extension member of Bar
fun Foo.check() = abc() + bar()
fun Foo.check() = <!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!>abc() <!INAPPLICABLE_CANDIDATE!>+<!> bar()<!>
// NB! + here is resolved to member String.plus (not to extension member above)
fun Foo.check2() = "" + bar()
@@ -41,9 +41,9 @@ fun f() {
val a = 10
val b = a
val d = ""
val c = c
val c = <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>c<!>
abc()
<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>abc<!>()<!>
fun bcd() {}
@@ -57,7 +57,7 @@ fun f() {
dcb()
}
dcb()
<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>dcb<!>()<!>
abc()
}
@@ -22,5 +22,5 @@ fun test() {
B.baz()
val x = A.D
val y = B.C
val z = B.D
val z = B.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>D<!>
}
@@ -7,5 +7,5 @@ fun <T : Foo> foo(t: T) = t
fun main(fooImpl: FooImpl, bar: Bar) {
val a = foo(fooImpl)
val b = foo(bar)
val b = <!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>(bar)<!>
}
@@ -6,6 +6,6 @@ fun <T : Foo> foo(t: T) = t
fun main(fooImpl: FooImpl, fooBarImpl: FooBarImpl) {
val a = foo<FooImpl>(fooBarImpl)
val a = <!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!><FooImpl>(fooBarImpl)<!>
val b = foo<Foo>(fooImpl)
}
@@ -12,6 +12,6 @@ class Foo {
val Buz.foobar: Bar get() = Bar()
fun FooBar.chk(buz: Buz) {
buz.foobar()
buz.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>foobar<!>()<!>
}
}
@@ -3,11 +3,11 @@ interface A {
}
fun <T> myWith(receiver: T, block: T.() -> Unit) {
receiver.block()
receiver.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>block<!>()<!>
}
fun <T> T.myApply(block: T.() -> Unit) {
this.block()
this.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>block<!>()<!>
}
fun withA(block: A.() -> Unit) {}
@@ -23,6 +23,6 @@ fun test() {
val derived = DerivedLocal()
derived.gau()
derived.baz()
derived.foo()
derived.<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>baz<!>()<!>
derived.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>foo<!>()<!>
}
@@ -5,5 +5,5 @@ class Foo {
fun test() {
var f = Foo()
f += f
<!ASSIGN_OPERATOR_AMBIGUITY!>f += f<!>
}
@@ -13,5 +13,5 @@ FILE: plusAndPlusAssign.kt
}
public final fun test(): R|kotlin/Unit| {
lvar f: R|Foo| = R|/Foo.Foo|()
ERROR_EXPR(Operator overload ambiguity. plusAssign and plus are compatible)
ERROR_EXPR(Operator overload ambiguity. Compatible candidates: [/Foo.plus, /Foo.plusAssign])
}
@@ -7,7 +7,7 @@ class Foo {
fun test_1() {
val f = Foo()
f + f
<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>f <!UNRESOLVED_REFERENCE!>+<!> f<!>
}
fun test_2() {
@@ -6,7 +6,7 @@ class C {
class Nested {
fun test() {
err()
<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>err<!>()<!>
}
}
}
@@ -17,5 +17,5 @@ fun test() {
c.bar()
val err = C()
err.foo()
err.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>foo<!>()<!>
}
+3 -3
View File
@@ -9,17 +9,17 @@ enum class Order {
enum class Planet(val m: Double, internal val r: Double) {
MERCURY(1.0, 2.0) {
override fun sayHello() {
println("Hello!!!")
<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>println<!>("Hello!!!")<!>
}
},
VENERA(3.0, 4.0) {
override fun sayHello() {
println("Ola!!!")
<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>println<!>("Ola!!!")<!>
}
},
EARTH(5.0, 6.0) {
override fun sayHello() {
println("Privet!!!")
<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>println<!>("Privet!!!")<!>
}
};
@@ -1,7 +1,7 @@
interface List<out T : Any> {
operator fun get(index: Int): T
infix fun concat(other: List<T>): List<T>
<!INAPPLICABLE_INFIX_MODIFIER!>infix fun concat(other: List<T>): List<T><!>
}
typealias StringList = List<out String>
+1 -1
View File
@@ -4,7 +4,7 @@ fun <T, R> List<T>.simpleMap(f: (T) -> R): R {
}
fun <T> simpleWith(t: T, f: T.() -> Unit): Unit = t.f()
fun <T> simpleWith(t: T, f: T.() -> Unit): Unit = t.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>f<!>()<!>
interface KMutableProperty1<T, R> : KProperty1<T, R>, KMutableProperty<R>
+3 -3
View File
@@ -23,7 +23,7 @@ class Owner {
o.foo()
foo()
this@Owner.foo()
this.err()
this.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>err<!>()<!>
}
}
}
@@ -31,8 +31,8 @@ class Owner {
fun test() {
val o = Owner()
o.foo()
val err = Owner.Inner()
err.baz()
val err = Owner.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>Inner<!>()<!>
err.<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>baz<!>()<!>
val i = o.Inner()
i.gau()
}
+2 -2
View File
@@ -22,8 +22,8 @@ class Owner {
}
fun err() {
foo()
this.foo()
<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>foo<!>()<!>
this.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>foo<!>()<!>
}
}
}
+1 -1
View File
@@ -14,7 +14,7 @@ class B : A() {
fun test() {
foo()
bar()
buz()
<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>buz<!>()<!>
}
}
@@ -23,8 +23,8 @@ fun test_1(x: Any) {
fun test_2(x: Any) {
if (x is B || x is C) {
x.foo()
x.bar()
x.baz()
x.<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>bar<!>()<!>
x.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>baz<!>()<!>
}
}
@@ -36,20 +36,20 @@ fun test_3(x: Any) {
fun test_4(x: Any) {
if (x !is String || x.length == 0) {
x.length
x.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>length<!>
}
x.length
x.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>length<!>
}
fun test_5(x: A?) {
if (x != null || false) {
x.foo()
x.<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>()<!>
}
}
fun test_6(x: A?) {
if (false || x != null) {
x.foo()
x.<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>()<!>
}
}
@@ -29,7 +29,7 @@ fun test_3(x: Any, y: Any) {
}
z = y
if (y is B) {
z.bar()
z.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>bar<!>()<!>
}
}
@@ -40,7 +40,7 @@ fun test_4(y: Any) {
x = y
x.inc()
if (y is A) {
x.foo()
x.<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>foo<!>()<!>
y.foo()
}
}
+8 -8
View File
@@ -14,31 +14,31 @@ fun test_3(b: Boolean, x: Any?) {
if (b && x as Boolean) {
x.not()
}
x.not()
x.<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>not<!>()<!>
if (b && x as Boolean == true) {
x.not()
}
x.not()
x.<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>not<!>()<!>
if (b || x as Boolean) {
x.not()
x.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>not<!>()<!>
}
x.not()
x.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>not<!>()<!>
}
fun test_4(b: Any) {
if (b as? Boolean != null) {
b.not()
} else {
b.not()
b.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>not<!>()<!>
}
b.not()
b.<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>not<!>()<!>
if (b as? Boolean == null) {
b.not()
b.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>not<!>()<!>
} else {
b.not()
}
b.not()
b.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>not<!>()<!>
}
@@ -43,7 +43,7 @@ fun test_4(x: Any, b: Boolean) {
}
break
}
x.foo() // No smartcast
x.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>foo<!>()<!> // No smartcast
}
fun test_5(x: Any, b: Boolean) {
@@ -15,12 +15,12 @@ fun test_1(x: A, y: A?) {
fun test_2(x: A?, y: A?) {
if (x == y) {
x.foo()
y.foo()
x.<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>()<!>
y.<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>()<!>
}
if (x === y) {
x.foo()
y.foo()
x.<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>()<!>
y.<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>()<!>
}
}
@@ -7,13 +7,13 @@ fun test_1(b: Boolean?) {
if ((b == true) == true) {
b.not() // OK
} else {
b.not() // Bad
b.<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>not<!>()<!> // Bad
}
}
fun test_2(b: Boolean?) {
if ((b == true) != true) {
b.not() // Bad
b.<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>not<!>()<!> // Bad
} else {
b.not() // OK
}
@@ -21,7 +21,7 @@ fun test_2(b: Boolean?) {
fun test_3(b: Boolean?) {
if ((b == true) == false) {
b.not() // Bad
b.<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>not<!>()<!> // Bad
} else {
b.not() // OK
}
@@ -31,13 +31,13 @@ fun test_4(b: Boolean?) {
if ((b == true) != false) {
b.not() // OK
} else {
b.not() // Bad
b.<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>not<!>()<!> // Bad
}
}
fun test_5(b: Boolean?) {
if ((b != true) == true) {
b.not() // Bad
b.<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>not<!>()<!> // Bad
} else {
b.not() // OK
}
@@ -47,7 +47,7 @@ fun test_6(b: Boolean?) {
if ((b != true) != true) {
b.not() // OK
} else {
b.not() // Bad
b.<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>not<!>()<!> // Bad
}
}
@@ -55,13 +55,13 @@ fun test_7(b: Boolean?) {
if ((b != true) == false) {
b.not() // OK
} else {
b.not() // Bad
b.<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>not<!>()<!> // Bad
}
}
fun test_8(b: Boolean?) {
if ((b != true) != false) {
b.not() // Bad
b.<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>not<!>()<!> // Bad
} else {
b.not() // OK
}
@@ -9,23 +9,23 @@ fun Any?.test_1() {
this.foo()
foo()
} else {
this.foo()
foo()
this.<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>foo<!>()<!>
<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>foo<!>()<!>
}
this.foo()
foo()
this.<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>foo<!>()<!>
<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>foo<!>()<!>
}
fun Any?.test_2() {
if (this !is A) {
this.foo()
foo()
this.<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>foo<!>()<!>
<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>foo<!>()<!>
} else {
this.foo()
foo()
}
this.foo()
foo()
this.<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>foo<!>()<!>
<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>foo<!>()<!>
}
@@ -21,18 +21,18 @@ fun test_1(x: A?) {
if (x != null) {
x.foo()
} else {
x.foo()
x.<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>()<!>
}
x.foo()
x.<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>()<!>
}
fun test_2(x: A?) {
if (x == null) {
x.foo()
x.<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>()<!>
} else {
x.foo()
}
x.foo()
x.<!INAPPLICABLE_CANDIDATE, INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>foo<!>()<!>
}
fun test_3(x: A?) {
@@ -63,8 +63,8 @@ fun test_6(q: Q?) {
fun test_7(q: Q?) {
if (q?.fdata()?.fs()?.inc() != null) {
q.fdata() // good
q.fdata().fs() // bad
q.fdata().fs().inc() // bad
q.fdata().<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>fs<!>()<!> // bad
q.fdata().<!INAPPLICABLE_CANDIDATE!><!INAPPLICABLE_CANDIDATE!>fs<!>()<!>.<!AMBIGUITY, AMBIGUITY!><!AMBIGUITY!>inc<!>()<!> // bad
}
}
@@ -78,42 +78,42 @@ fun test_9(a: Int, b: Int?) {
if (a == b) {
b.inc()
}
b.inc()
b.<!AMBIGUITY!><!AMBIGUITY!>inc<!>()<!>
if (a === b) {
b.inc()
}
b.inc()
b.<!AMBIGUITY!><!AMBIGUITY!>inc<!>()<!>
if (b == a) {
b.inc()
}
b.inc()
b.<!AMBIGUITY!><!AMBIGUITY!>inc<!>()<!>
if (b === a) {
b.inc()
}
b.inc()
b.<!AMBIGUITY, AMBIGUITY!><!AMBIGUITY!>inc<!>()<!>
}
fun test_10(a: Int?, b: Int?) {
if (a == b) {
b.inc()
b.<!AMBIGUITY, AMBIGUITY!><!AMBIGUITY!>inc<!>()<!>
}
b.inc()
b.<!AMBIGUITY!><!AMBIGUITY!>inc<!>()<!>
if (a === b) {
b.inc()
b.<!AMBIGUITY, AMBIGUITY!><!AMBIGUITY!>inc<!>()<!>
}
b.inc()
b.<!AMBIGUITY!><!AMBIGUITY!>inc<!>()<!>
if (b == a) {
b.inc()
b.<!AMBIGUITY, AMBIGUITY!><!AMBIGUITY!>inc<!>()<!>
}
b.inc()
b.<!AMBIGUITY!><!AMBIGUITY!>inc<!>()<!>
if (b === a) {
b.inc()
b.<!AMBIGUITY, AMBIGUITY!><!AMBIGUITY!>inc<!>()<!>
}
b.inc()
b.<!AMBIGUITY, AMBIGUITY!><!AMBIGUITY!>inc<!>()<!>
}
@@ -4,7 +4,7 @@ fun test_0(x: Any) {
} else {
}
x.length
x.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>length<!>
}
fun test_1(x: Any) {
@@ -35,8 +35,8 @@ fun test_2(x: Any) {
else -> return
}
x.foo()
x.bar()
x.baz()
x.<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>bar<!>()<!>
x.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>baz<!>()<!>
}
fun test_3(x: Any) {
@@ -44,7 +44,7 @@ fun test_3(x: Any) {
x is B -> x.bar()
x is C -> x.baz()
}
x.foo()
x.bar()
x.baz()
x.<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>foo<!>()<!>
x.<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>bar<!>()<!>
x.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>baz<!>()<!>
}
@@ -2,7 +2,7 @@ fun test_1(x: Any) {
if (x is String) {
x.length
}
x.length
x.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>length<!>
}
fun test_2(x: Any) {
@@ -10,7 +10,7 @@ fun test_2(x: Any) {
if (b) {
x.length
}
x.length
x.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>length<!>
}
fun test_3(x: Any) {
@@ -24,9 +24,9 @@ fun test_5(x: Any, b: Boolean) {
require(x is String)
x.length
} else {
x.length
x.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>length<!>
}
x.length
x.<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>length<!>
}
fun test_6(x: Any, b: Boolean) {
+1 -1
View File
@@ -30,5 +30,5 @@ class BC : B, C
fun C.analyze() {}
inline fun <reified T> T.analyze() where T : A, T : B {}
fun testAnalyze() {
BC().analyze()
BC().<!AMBIGUITY, AMBIGUITY!><!AMBIGUITY!>analyze<!>()<!>
}
@@ -42,7 +42,7 @@ fun test_2(inv: Inv2<A, B>) {
fun test_3(inv: Inv3<A, B, C>) {
inv.k().foo()
inv.t().bar()
inv.t().<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>bar<!>()<!>
inv.t().baz()
}
+2 -2
View File
@@ -1,8 +1,8 @@
fun <T, R> T.also(block: () -> R): R {
null!!
return <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>null!!<!>
}
fun foo(b: Boolean) {
fun foo(b: Boolean, a: Int) {
val x = when (b) {
true -> a
else -> null
+5 -5
View File
@@ -1,6 +1,6 @@
FILE: whenAsReceiver.kt
public final fun <T, R> R|T|.also(block: R|kotlin/Function0<R>|): R|R| {
when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
^also when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
==($subj$, Null(null)) -> {
throw <Unresolved name: KotlinNullPointerException>#()
}
@@ -10,16 +10,16 @@ FILE: whenAsReceiver.kt
}
}
public final fun foo(b: R|kotlin/Boolean|): R|kotlin/Unit| {
lval x: <ERROR TYPE REF: Inapplicable(WRONG_RECEIVER): [/also]> = when (R|<local>/b|) {
public final fun foo(b: R|kotlin/Boolean|, a: R|kotlin/Int|): R|kotlin/Unit| {
lval x: R|kotlin/Int?| = when (R|<local>/b|) {
==($subj$, Boolean(true)) -> {
<Unresolved name: a>#
R|<local>/a|
}
else -> {
Null(null)
}
}
?.<Inapplicable(WRONG_RECEIVER): [/also]>#(<L> = also@fun <implicit>.<anonymous>(): <implicit> {
?.R|/also|<R|kotlin/Int|, R|kotlin/Int|>(<L> = also@fun <anonymous>(): R|kotlin/Int| {
Int(1)
}
)
@@ -5,17 +5,32 @@
package org.jetbrains.kotlin.fir
import com.intellij.openapi.util.TextRange
import com.intellij.psi.search.GlobalSearchScope
import org.jetbrains.kotlin.checkers.DiagnosedRange
import org.jetbrains.kotlin.checkers.DiagnosticDiffCallbacks
import org.jetbrains.kotlin.checkers.TestCheckerUtil
import org.jetbrains.kotlin.checkers.diagnostics.ActualDiagnostic
import org.jetbrains.kotlin.checkers.diagnostics.PositionalTextDiagnostic
import org.jetbrains.kotlin.checkers.diagnostics.TextDiagnostic
import org.jetbrains.kotlin.checkers.utils.CheckerTestUtil
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM
import org.jetbrains.kotlin.diagnostics.PsiDiagnosticUtils
import org.jetbrains.kotlin.fir.builder.RawFirBuilder
import org.jetbrains.kotlin.fir.declarations.FirFile
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeDiagnostic
import org.jetbrains.kotlin.fir.resolve.diagnostics.collectors.AbstractDiagnosticCollector
import org.jetbrains.kotlin.fir.resolve.diagnostics.collectors.ParallelDiagnosticsCollector
import org.jetbrains.kotlin.fir.resolve.diagnostics.collectors.registerAllComponents
import org.jetbrains.kotlin.fir.resolve.firProvider
import org.jetbrains.kotlin.fir.resolve.impl.FirProviderImpl
import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveTransformer
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.ConfigurationKind
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.test.TestFiles
import java.io.File
abstract class AbstractFirResolveTestCase : AbstractFirResolveWithSessionTestCase() {
@@ -69,7 +84,12 @@ abstract class AbstractFirResolveTestCase : AbstractFirResolveWithSessionTestCas
}
open fun doTest(path: String) {
checkFir(path, processInputFile(path))
val file = File(path)
val expectedText = KotlinTestUtils.doLoadFile(file)
val testFiles = createTestFiles(file, expectedText)
val firFiles = doCreateAndProcessFir(testFiles.mapNotNull { it.ktFile })
checkDiagnostics(file, testFiles, firFiles)
checkFir(path, firFiles)
}
fun checkFir(path: String, firFiles: List<FirFile>) {
@@ -77,4 +97,155 @@ abstract class AbstractFirResolveTestCase : AbstractFirResolveWithSessionTestCas
val expectedPath = path.replace(".kt", ".txt")
KotlinTestUtils.assertEqualsToFile(File(expectedPath), firFileDump)
}
private fun createCollector(): AbstractDiagnosticCollector {
// val collector = SimpleDiagnosticsCollector()
val collector = ParallelDiagnosticsCollector(4)
collector.registerAllComponents()
return collector
}
private fun checkDiagnostics(file: File, testFiles: List<TestFile>, firFiles: List<FirFile>) {
val collector = createCollector()
val actualText = StringBuilder()
for ((testFile, firFile) in testFiles zip firFiles) {
val coneDiagnostics = collector.collectDiagnostics(firFile)
testFile.getActualText(coneDiagnostics, actualText)
}
KotlinTestUtils.assertEqualsToFile(file, actualText.toString())
}
private fun createTestFiles(file: File, expectedText: String?): List<TestFile> {
return TestFiles.createTestFiles(file.name, expectedText, object : TestFiles.TestFileFactory<Nothing?, TestFile> {
override fun createFile(module: Nothing?, fileName: String, text: String, directives: MutableMap<String, String>): TestFile {
return TestFile(fileName, text, directives)
}
override fun createModule(name: String, dependencies: MutableList<String>, friends: MutableList<String>): Nothing? {
return null
}
})
}
private inner class TestFile(
fileName: String,
textWithMarkers: String,
val directives: Map<String, String>
) {
private val diagnosedRanges: MutableList<DiagnosedRange> = mutableListOf()
private val diagnosedRangesToDiagnosticNames: MutableMap<IntRange, MutableSet<String>> = mutableMapOf()
val ktFile: KtFile? by lazy {
if (fileName.endsWith(".java")) {
null
} else {
TestCheckerUtil.createCheckAndReturnPsiFile(fileName, clearText, project)
}
}
val actualDiagnostics: MutableList<ActualDiagnostic> = mutableListOf()
val clearText: String
val expectedText: String
init {
if (fileName.endsWith(".java")) {
clearText = textWithMarkers
expectedText = clearText
} else {
expectedText = textWithMarkers
clearText = CheckerTestUtil.parseDiagnosedRanges(addExtracts(expectedText), diagnosedRanges, diagnosedRangesToDiagnosticNames)
}
}
fun addExtracts(text: String): String {
// TODO
return text
}
fun getActualText(
coneDiagnostics: Iterable<ConeDiagnostic>,
actualText: StringBuilder
): Boolean {
val ktFile = this.ktFile
if (ktFile == null) {
// TODO: check java files too
actualText.append(this.clearText)
return true
}
if (ktFile.name.endsWith("CoroutineUtil.kt") && ktFile.packageFqName == FqName("helpers")) return true
// TODO: report JVM signature diagnostics also for implementing modules
val ok = booleanArrayOf(true)
val diagnostics = coneDiagnostics.toActualDiagnostic()
val filteredDiagnostics = diagnostics // TODO
actualDiagnostics.addAll(filteredDiagnostics)
val uncheckedDiagnostics = mutableListOf<PositionalTextDiagnostic>()
val diagnosticToExpectedDiagnostic =
CheckerTestUtil.diagnosticsDiff(diagnosedRanges, filteredDiagnostics, object : DiagnosticDiffCallbacks {
override fun missingDiagnostic(diagnostic: TextDiagnostic, expectedStart: Int, expectedEnd: Int) {
val message = "Missing " + diagnostic.description + PsiDiagnosticUtils.atLocation(
ktFile,
TextRange(expectedStart, expectedEnd)
)
System.err.println(message)
ok[0] = false
}
override fun wrongParametersDiagnostic(
expectedDiagnostic: TextDiagnostic,
actualDiagnostic: TextDiagnostic,
start: Int,
end: Int
) {
val message = "Parameters of diagnostic not equal at position " +
PsiDiagnosticUtils.atLocation(ktFile, TextRange(start, end)) +
". Expected: ${expectedDiagnostic.asString()}, actual: $actualDiagnostic"
System.err.println(message)
ok[0] = false
}
override fun unexpectedDiagnostic(diagnostic: TextDiagnostic, actualStart: Int, actualEnd: Int) {
val message = "Unexpected ${diagnostic.description}${PsiDiagnosticUtils.atLocation(
ktFile,
TextRange(actualStart, actualEnd)
)}"
System.err.println(message)
ok[0] = false
}
fun updateUncheckedDiagnostics(diagnostic: TextDiagnostic, start: Int, end: Int) {
uncheckedDiagnostics.add(PositionalTextDiagnostic(diagnostic, start, end))
}
})
actualText.append(
CheckerTestUtil.addDiagnosticMarkersToText(
ktFile,
filteredDiagnostics,
diagnosticToExpectedDiagnostic,
{ file -> file.text },
uncheckedDiagnostics,
false,
false
)
)
stripExtras(actualText)
return ok[0]
}
private fun stripExtras(text: StringBuilder): StringBuilder {
// TODO
return text
}
}
private fun Iterable<ConeDiagnostic>.toActualDiagnostic(): Collection<ActualDiagnostic> {
return map { ActualDiagnostic(it.diagnostic, null, true) }
}
}
@@ -1,189 +0,0 @@
/*
* Copyright 2010-2019 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.fir
import com.intellij.openapi.util.TextRange
import org.jetbrains.kotlin.checkers.DiagnosedRange
import org.jetbrains.kotlin.checkers.DiagnosticDiffCallbacks
import org.jetbrains.kotlin.checkers.TestCheckerUtil
import org.jetbrains.kotlin.checkers.diagnostics.ActualDiagnostic
import org.jetbrains.kotlin.checkers.diagnostics.PositionalTextDiagnostic
import org.jetbrains.kotlin.checkers.diagnostics.TextDiagnostic
import org.jetbrains.kotlin.checkers.utils.CheckerTestUtil
import org.jetbrains.kotlin.diagnostics.PsiDiagnosticUtils
import org.jetbrains.kotlin.fir.declarations.FirFile
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeDiagnostic
import org.jetbrains.kotlin.fir.resolve.diagnostics.collectors.AbstractDiagnosticCollector
import org.jetbrains.kotlin.fir.resolve.diagnostics.collectors.ParallelDiagnosticsCollector
import org.jetbrains.kotlin.fir.resolve.diagnostics.collectors.components.DeclarationCheckersDiagnosticComponent
import org.jetbrains.kotlin.fir.resolve.diagnostics.collectors.registerAllComponents
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.test.TestFiles
import java.io.File
abstract class AbstractFirResolveWithDiagnosticsTestCase : AbstractFirResolveTestCase() {
override fun doTest(path: String) {
val file = File(path)
val expectedText = KotlinTestUtils.doLoadFile(file)
val testFiles = createTestFiles(file, expectedText)
val firFiles = doCreateAndProcessFir(testFiles.mapNotNull { it.ktFile })
checkFir(path, firFiles)
checkDiagnostics(file, testFiles, firFiles)
}
private fun createCollector(): AbstractDiagnosticCollector {
// val collector = SimpleDiagnosticsCollector()
val collector = ParallelDiagnosticsCollector(4)
collector.registerAllComponents()
return collector
}
private fun checkDiagnostics(file: File, testFiles: List<TestFile>, firFiles: List<FirFile>) {
val collector = createCollector()
val actualText = StringBuilder()
for ((testFile, firFile) in testFiles zip firFiles) {
val coneDiagnostics = collector.collectDiagnostics(firFile)
testFile.getActualText(coneDiagnostics, actualText)
}
KotlinTestUtils.assertEqualsToFile(file, actualText.toString())
}
private fun createTestFiles(file: File, expectedText: String?): List<TestFile> {
return TestFiles.createTestFiles(file.name, expectedText, object : TestFiles.TestFileFactory<Nothing?, TestFile> {
override fun createFile(module: Nothing?, fileName: String, text: String, directives: MutableMap<String, String>): TestFile {
return TestFile(fileName, text, directives)
}
override fun createModule(name: String, dependencies: MutableList<String>, friends: MutableList<String>): Nothing? {
return null
}
})
}
private inner class TestFile(
fileName: String,
textWithMarkers: String,
val directives: Map<String, String>
) {
private val diagnosedRanges: MutableList<DiagnosedRange> = mutableListOf()
private val diagnosedRangesToDiagnosticNames: MutableMap<IntRange, MutableSet<String>> = mutableMapOf()
val ktFile: KtFile? by lazy {
if (fileName.endsWith(".java")) {
null
} else {
TestCheckerUtil.createCheckAndReturnPsiFile(fileName, clearText, project)
}
}
val actualDiagnostics: MutableList<ActualDiagnostic> = mutableListOf()
val clearText: String
val expectedText: String
init {
if (fileName.endsWith(".java")) {
clearText = textWithMarkers
expectedText = clearText
} else {
expectedText = textWithMarkers
clearText = CheckerTestUtil.parseDiagnosedRanges(addExtracts(expectedText), diagnosedRanges, diagnosedRangesToDiagnosticNames)
}
}
fun addExtracts(text: String): String {
// TODO
return text
}
fun getActualText(
coneDiagnostics: Iterable<ConeDiagnostic>,
actualText: StringBuilder
): Boolean {
val ktFile = this.ktFile
if (ktFile == null) {
// TODO: check java files too
actualText.append(this.clearText)
return true
}
if (ktFile.name.endsWith("CoroutineUtil.kt") && ktFile.packageFqName == FqName("helpers")) return true
// TODO: report JVM signature diagnostics also for implementing modules
val ok = booleanArrayOf(true)
val diagnostics = coneDiagnostics.toActualDiagnostic()
val filteredDiagnostics = diagnostics // TODO
actualDiagnostics.addAll(filteredDiagnostics)
val uncheckedDiagnostics = mutableListOf<PositionalTextDiagnostic>()
val diagnosticToExpectedDiagnostic =
CheckerTestUtil.diagnosticsDiff(diagnosedRanges, filteredDiagnostics, object : DiagnosticDiffCallbacks {
override fun missingDiagnostic(diagnostic: TextDiagnostic, expectedStart: Int, expectedEnd: Int) {
val message = "Missing " + diagnostic.description + PsiDiagnosticUtils.atLocation(
ktFile,
TextRange(expectedStart, expectedEnd)
)
System.err.println(message)
ok[0] = false
}
override fun wrongParametersDiagnostic(
expectedDiagnostic: TextDiagnostic,
actualDiagnostic: TextDiagnostic,
start: Int,
end: Int
) {
val message = "Parameters of diagnostic not equal at position " +
PsiDiagnosticUtils.atLocation(ktFile, TextRange(start, end)) +
". Expected: ${expectedDiagnostic.asString()}, actual: $actualDiagnostic"
System.err.println(message)
ok[0] = false
}
override fun unexpectedDiagnostic(diagnostic: TextDiagnostic, actualStart: Int, actualEnd: Int) {
val message = "Unexpected ${diagnostic.description}${PsiDiagnosticUtils.atLocation(
ktFile,
TextRange(actualStart, actualEnd)
)}"
System.err.println(message)
ok[0] = false
}
fun updateUncheckedDiagnostics(diagnostic: TextDiagnostic, start: Int, end: Int) {
uncheckedDiagnostics.add(PositionalTextDiagnostic(diagnostic, start, end))
}
})
actualText.append(
CheckerTestUtil.addDiagnosticMarkersToText(
ktFile,
filteredDiagnostics,
diagnosticToExpectedDiagnostic,
{ file -> file.text },
uncheckedDiagnostics,
false,
false
)
)
stripExtras(actualText)
return ok[0]
}
private fun stripExtras(text: StringBuilder): StringBuilder {
// TODO
return text
}
}
private fun Iterable<ConeDiagnostic>.toActualDiagnostic(): Collection<ActualDiagnostic> {
return map { ActualDiagnostic(it.diagnostic, null, true) }
}
}
@@ -25,7 +25,7 @@ public class FirResolveTestCaseGenerated extends AbstractFirResolveTestCase {
}
public void testAllFilesPresentInResolve() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/fir/resolve/testData/resolve"), Pattern.compile("^([^.]+)\\.kt$"), true, "stdlib", "cfg", "smartcasts", "diagnostics");
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/fir/resolve/testData/resolve"), Pattern.compile("^([^.]+)\\.kt$"), true, "stdlib", "cfg", "smartcasts");
}
@TestMetadata("cast.kt")
@@ -264,6 +264,24 @@ public class FirResolveTestCaseGenerated extends AbstractFirResolveTestCase {
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/diagnostics")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Diagnostics extends AbstractFirResolveTestCase {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInDiagnostics() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/fir/resolve/testData/resolve/diagnostics"), Pattern.compile("^([^.]+)\\.kt$"), true);
}
@TestMetadata("infixFunctions.kt")
public void testInfixFunctions() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/diagnostics/infixFunctions.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/expresssions")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -1,35 +0,0 @@
/*
* Copyright 2010-2019 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.fir;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/fir/resolve/testData/resolve/diagnostics")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class FirResolveWithDiagnosticsTestCaseGenerated extends AbstractFirResolveWithDiagnosticsTestCase {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInDiagnostics() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/fir/resolve/testData/resolve/diagnostics"), Pattern.compile("^([^.]+)\\.kt$"), true);
}
@TestMetadata("infixFunctions.kt")
public void testInfixFunctions() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/diagnostics/infixFunctions.kt");
}
}
@@ -513,7 +513,7 @@ fun main(args: Array<String>) {
testGroup("compiler/fir/resolve/tests", "compiler/fir/resolve/testData") {
testClass<AbstractFirResolveTestCase> {
model("resolve", pattern = KT_WITHOUT_DOTS_IN_NAME, excludeDirs = listOf("stdlib", "cfg", "smartcasts", "diagnostics"))
model("resolve", pattern = KT_WITHOUT_DOTS_IN_NAME, excludeDirs = listOf("stdlib", "cfg", "smartcasts"))
}
testClass<AbstractFirCfgBuildingTest> {
@@ -528,10 +528,6 @@ fun main(args: Array<String>) {
testClass<AbstractFirCfgBuildingWithStdlibTest> {
model("resolve/stdlib/contracts", pattern = KT_WITHOUT_DOTS_IN_NAME)
}
testClass<AbstractFirResolveWithDiagnosticsTestCase> {
model("resolve/diagnostics", pattern = KT_WITHOUT_DOTS_IN_NAME)
}
}
testGroup("compiler/fir/resolve/tests", "compiler/testData") {