FIR: Update test data (NEW_INFERENCE_ERROR)

Though these diagnostics look correct (the calls or constraint
systems indeed contain errors), more precise diagnostic kinds should be
chosen later.
This commit is contained in:
Denis.Zharkov
2021-04-28 10:58:42 +03:00
committed by teamcityserver
parent 010a0c6cdc
commit da3233c47d
19 changed files with 58 additions and 45 deletions
@@ -2,5 +2,5 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE // !DIAGNOSTICS: -UNUSED_VARIABLE
fun main() { fun main() {
val x = run { ::run } // no error val x = <!NEW_INFERENCE_ERROR!>run { ::run }<!> // no error
} }
@@ -38,7 +38,7 @@ fun <R> select(vararg x: R) = x[0]
fun poll0(): Flow<String> { fun poll0(): Flow<String> {
return flow { return flow {
val inv = select(::bar, ::foo) val inv = <!NEW_INFERENCE_ERROR!>select(::bar, ::foo)<!>
inv(<!NO_VALUE_FOR_PARAMETER!>)<!> inv(<!NO_VALUE_FOR_PARAMETER!>)<!>
} }
} }
@@ -52,7 +52,7 @@ fun poll01(): Flow<String> {
fun poll02(): Flow<String> { fun poll02(): Flow<String> {
return flow { return flow {
val inv = select(::bar3, ::foo3) val inv = <!NEW_INFERENCE_ERROR!>select(::bar3, ::foo3)<!>
inv() inv()
} }
} }
@@ -66,7 +66,7 @@ fun poll03(): Flow<String> {
fun poll04(): Flow<String> { fun poll04(): Flow<String> {
return flow { return flow {
val inv = select(::bar5, ::foo5) val inv = <!NEW_INFERENCE_ERROR!>select(::bar5, ::foo5)<!>
inv inv
} }
} }
@@ -437,7 +437,7 @@ fun poll76(): Flow<String> {
fun poll8(): Flow<String> { fun poll8(): Flow<String> {
return flow { return flow {
val inv = ::bar in setOf(::foo) val inv = <!NEW_INFERENCE_ERROR!>::bar in <!NEW_INFERENCE_ERROR!>setOf(::foo)<!><!>
<!UNRESOLVED_REFERENCE!>inv<!>() <!UNRESOLVED_REFERENCE!>inv<!>()
} }
} }
@@ -451,7 +451,7 @@ fun poll81(): Flow<String> {
fun poll82(): Flow<String> { fun poll82(): Flow<String> {
return flow { return flow {
val inv = ::bar3 in setOf(::foo3) val inv = ::bar3 in <!NEW_INFERENCE_ERROR!>setOf(::foo3)<!>
<!UNRESOLVED_REFERENCE!>inv<!>() <!UNRESOLVED_REFERENCE!>inv<!>()
} }
} }
@@ -465,7 +465,7 @@ fun poll83(): Flow<String> {
fun poll84(): Flow<String> { fun poll84(): Flow<String> {
return flow { return flow {
val inv = ::bar5 in setOf(::foo5) val inv = <!NEW_INFERENCE_ERROR!>::bar5 in <!NEW_INFERENCE_ERROR!>setOf(::foo5)<!><!>
inv inv
} }
} }
@@ -479,7 +479,7 @@ fun poll85(): Flow<String> {
fun poll86(): Flow<String> { fun poll86(): Flow<String> {
return flow { return flow {
val inv = ::Foo7 in setOf(::Foo7) val inv = <!NEW_INFERENCE_ERROR!>::Foo7 in <!NEW_INFERENCE_ERROR!>setOf(::Foo7)<!><!>
inv inv
} }
} }
@@ -493,7 +493,7 @@ fun poll87(): Flow<String> {
fun poll88(): Flow<String> { fun poll88(): Flow<String> {
return flow { return flow {
val inv = foo7() in setOf(::Foo7) val inv = foo7() in <!NEW_INFERENCE_ERROR!>setOf(::Foo7)<!>
inv inv
} }
} }
@@ -5,5 +5,5 @@
class Foo<T : Enum<T>>(val values: Array<T>) class Foo<T : Enum<T>>(val values: Array<T>)
fun foo(x: Array<out Enum<*>>) { fun foo(x: Array<out Enum<*>>) {
val y = Foo(x) val y = <!NEW_INFERENCE_ERROR!>Foo(x)<!>
} }
@@ -3,11 +3,11 @@
fun <T : Number> materializeNumber(): T = TODO() fun <T : Number> materializeNumber(): T = TODO()
fun a(): Unit = run { fun a(): Unit = run {
materializeNumber() <!NEW_INFERENCE_ERROR!>materializeNumber()<!>
} }
fun b(): Unit = run { fun b(): Unit = run {
run { run {
materializeNumber() <!NEW_INFERENCE_ERROR!>materializeNumber()<!>
} }
} }
@@ -0,0 +1,14 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface Base
class Foo : Base
fun <T : Base> myRun(action: () -> T): T = action()
fun foo(f: (Foo) -> Unit) {}
fun main() {
foo { f: Foo ->
<!NEW_INFERENCE_ERROR!>myRun { f }<!>
}
}
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER
interface Base interface Base
@@ -12,4 +11,4 @@ fun main() {
foo { f: Foo -> foo { f: Foo ->
myRun { f } myRun { f }
} }
} }
@@ -59,11 +59,11 @@ fun testVariableWithBound() {
c1 c1
val c2 = select(SubInv<String>(), createWithNumberBound()) val c2 = <!NEW_INFERENCE_ERROR!>select(SubInv<String>(), createWithNumberBound())<!>
c2 c2
val c3 = select(SubInv<Double>(), createWithIntBound()) val c3 = <!NEW_INFERENCE_ERROR!>select(SubInv<Double>(), createWithIntBound())<!>
c3 c3
} }
@@ -5,9 +5,9 @@ fun <K> id(x: K) = x
fun main() { fun main() {
val x1 = select<Any?>(id { x, y -> }, { x: Int, y -> }) val x1 = select<Any?>(id { x, y -> }, { x: Int, y -> })
val x2 = select(id { x, y -> }, { x: Int, y -> }) val x2 = <!NEW_INFERENCE_ERROR!>select(id { x, y -> }, { x: Int, y -> })<!>
val x3 = select(id(fun (x, y) {}), fun (x: Int, y) {}) val x3 = <!NEW_INFERENCE_ERROR!>select(id(fun (x, y) {}), fun (x: Int, y) {})<!>
val x4 = select<Any?>((fun (x, y) {}), fun (x: Int, y) {}) val x4 = select<Any?>((fun (x, y) {}), fun (x: Int, y) {})
val x5 = select<Any?>(id(fun (x, y) {}), fun (x: Int, y) {}) val x5 = select<Any?>(id(fun (x, y) {}), fun (x: Int, y) {})
@@ -262,8 +262,8 @@ class Main<L>(x: L?, y: L) {
val x471 = foo47(y) val x471 = foo47(y)
fun <R> takeLambda(block: () -> R): R = materialize() fun <R> takeLambda(block: () -> R): R = materialize()
val x480 = takeLambda { foo48 { x } } val x480 = <!NEW_INFERENCE_ERROR!>takeLambda { foo48 { <!ARGUMENT_TYPE_MISMATCH!>x<!> } }<!>
val x481 = takeLambda { foo48 { y } } val x481 = <!NEW_INFERENCE_ERROR!>takeLambda { foo48 { <!ARGUMENT_TYPE_MISMATCH!>y<!> } }<!>
val x482 = takeLambda { foo48 { null } } val x482 = takeLambda { foo48 { null } }
} }
@@ -9,5 +9,5 @@ fun <T: Inv2<T>> foo(klass: Inv<T>): String? = null
fun <X> bar(): Inv<X> = null!! fun <X> bar(): Inv<X> = null!!
fun test() { fun test() {
foo(bar()) <!NEW_INFERENCE_ERROR!>foo(bar())<!>
} }
@@ -24,7 +24,7 @@ fun test(z: Z) {
operator fun <T> Z.plus(a: A<T>): A<T> = a operator fun <T> Z.plus(a: A<T>): A<T> = a
fun test1(z: Z) { fun test1(z: Z) {
id(z + newA()) <!NEW_INFERENCE_ERROR!>id(z + newA())<!>
val a: A<Z> = z + newA() val a: A<Z> = z + newA()
val b: A<Z> = z.plus(newA()) val b: A<Z> = z.plus(newA())
val c: A<Z> = id(z + newA()) val c: A<Z> = id(z + newA())
@@ -17,19 +17,19 @@ fun test1(b: Boolean?) {
} }
fun test2() { fun test2() {
select( <!NEW_INFERENCE_ERROR!>select(
materialize() materialize()
) )<!>
select(materialize(), materialize<String>()) select(materialize(), materialize<String>())
select(materialize(), null, Inv<String>()) select(materialize(), null, Inv<String>())
select( <!NEW_INFERENCE_ERROR!>select(
materialize(), materialize(),
null null
) )<!>
select( <!NEW_INFERENCE_ERROR!>select(
materialize(), materialize(),
materialize() materialize()
) )<!>
select( select(
materialize(), materialize(),
materialize(), materialize(),
@@ -284,7 +284,7 @@ fun poll82() {
} }
fun poll83() { fun poll83() {
val inv = ::bar4 in setOf(::foo4) val inv = <!NEW_INFERENCE_ERROR!>::bar4 in <!NEW_INFERENCE_ERROR!>setOf(::foo4)<!><!>
inv inv
} }
@@ -299,7 +299,7 @@ fun poll85() {
} }
fun poll86() { fun poll86() {
val inv = ::Foo7 in setOf(::Foo7) val inv = <!NEW_INFERENCE_ERROR!>::Foo7 in <!NEW_INFERENCE_ERROR!>setOf(::Foo7)<!><!>
inv inv
} }
@@ -309,6 +309,6 @@ fun poll87() {
} }
fun poll88() { fun poll88() {
val inv = foo7() in setOf(::Foo7) val inv = foo7() in <!NEW_INFERENCE_ERROR!>setOf(::Foo7)<!>
inv inv
} }
@@ -6,5 +6,5 @@ fun <E : Enum<E>> createMap(enumClass: Class<E>) {}
fun reproduce() { fun reproduce() {
val enumClass: Class<Enum<*>> = "any" as Class<Enum<*>> val enumClass: Class<Enum<*>> = "any" as Class<Enum<*>>
createMap(enumClass) <!NEW_INFERENCE_ERROR!>createMap(enumClass)<!>
} }
@@ -14,7 +14,7 @@ fun <T: A> emptyNullableListOfA(): List<T>? = null
fun testExclExcl() { fun testExclExcl() {
doList(emptyNullableListOfA()!!) //should be an error here doList(emptyNullableListOfA()!!) //should be an error here
val l: List<Int> = id(emptyNullableListOfA()!!) val l: List<Int> = <!INITIALIZER_TYPE_MISMATCH, NEW_INFERENCE_ERROR!>id(emptyNullableListOfA()!!)<!>
doList(strangeNullableList { doInt(it) }!!) //lambda should be analyzed (at completion phase) doList(strangeNullableList { doInt(it) }!!) //lambda should be analyzed (at completion phase)
} }
@@ -9,13 +9,13 @@ abstract class View4
interface View5 interface View5
fun <T: View1> findViewById1(): T = null as T fun <T: View1> findViewById1(): T = null as T
fun test1(): I = findViewById1() fun test1(): I = <!NEW_INFERENCE_ERROR, RETURN_TYPE_MISMATCH!>findViewById1()<!>
fun <T: View2> findViewById2(): T = null as T fun <T: View2> findViewById2(): T = null as T
fun test2(): I = findViewById2() fun test2(): I = findViewById2()
inline fun <reified T: View1> findViewById3(): T = null as T inline fun <reified T: View1> findViewById3(): T = null as T
fun test3(): I = findViewById3() fun test3(): I = <!NEW_INFERENCE_ERROR, RETURN_TYPE_MISMATCH!>findViewById3()<!>
inline fun <reified T: View2> findViewById4(): T = null as T inline fun <reified T: View2> findViewById4(): T = null as T
fun test4(): I = findViewById4() fun test4(): I = findViewById4()
@@ -39,17 +39,17 @@ inline fun <reified T> findViewById10(): T where T: View3, T: View5 = null as T
fun test10(): I = findViewById10() fun test10(): I = findViewById10()
fun <T: View2> findViewById11(): T = null as T fun <T: View2> findViewById11(): T = null as T
fun test11(): View4 = findViewById11() fun test11(): View4 = <!NEW_INFERENCE_ERROR, RETURN_TYPE_MISMATCH!>findViewById11()<!>
object Obj { object Obj {
fun <T: I> findViewById1(): T = null as T fun <T: I> findViewById1(): T = null as T
fun test1(): View1 = findViewById1() fun test1(): View1 = <!NEW_INFERENCE_ERROR, RETURN_TYPE_MISMATCH!>findViewById1()<!>
fun <T: I> findViewById2(): T = null as T fun <T: I> findViewById2(): T = null as T
fun test2(): View2 = findViewById2() fun test2(): View2 = findViewById2()
inline fun <reified T: I> findViewById3(): T = null as T inline fun <reified T: I> findViewById3(): T = null as T
fun test3(): View1 = findViewById3() fun test3(): View1 = <!NEW_INFERENCE_ERROR, RETURN_TYPE_MISMATCH!>findViewById3()<!>
inline fun <reified T: I> findViewById4(): T = null as T inline fun <reified T: I> findViewById4(): T = null as T
fun test4(): View2 = findViewById4() fun test4(): View2 = findViewById4()
@@ -67,13 +67,13 @@ object Obj {
fun test8(): View4 = findViewById8() fun test8(): View4 = findViewById8()
fun <T> findViewById9(): T where T: View3, T: View5 = null as T fun <T> findViewById9(): T where T: View3, T: View5 = null as T
fun test9(): View1 = findViewById9() fun test9(): View1 = <!NEW_INFERENCE_ERROR, RETURN_TYPE_MISMATCH!>findViewById9()<!>
inline fun <reified T> findViewById10(): T where T: View3, T: View5 = null as T inline fun <reified T> findViewById10(): T where T: View3, T: View5 = null as T
fun test10(): View1 = findViewById10() fun test10(): View1 = <!NEW_INFERENCE_ERROR, RETURN_TYPE_MISMATCH!>findViewById10()<!>
fun <T: View2> findViewById11(): T = null as T fun <T: View2> findViewById11(): T = null as T
fun test11(): View4 = findViewById11() fun test11(): View4 = <!NEW_INFERENCE_ERROR, RETURN_TYPE_MISMATCH!>findViewById11()<!>
} }
interface A interface A
@@ -10,7 +10,7 @@ fun <K> select(x: K, y: K): K = TODO()
fun takeUByte(u: UByte) {} fun takeUByte(u: UByte) {}
fun foo() { fun foo() {
select(1, 1u) checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Comparable<*>>() } <!NEW_INFERENCE_ERROR!>select(1, 1u)<!> checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Comparable<*>>() }
takeUByte(<!ARGUMENT_TYPE_MISMATCH!>id(1)<!>) takeUByte(<!ARGUMENT_TYPE_MISMATCH!>id(1)<!>)
1 <!NONE_APPLICABLE!>+<!> 1u 1 <!NONE_APPLICABLE!>+<!> 1u
@@ -20,7 +20,7 @@ suspend fun yield() {}
fun test() { fun test() {
builder { builder {
send(<!ARGUMENT_TYPE_MISMATCH!>run { send(<!ARGUMENT_TYPE_MISMATCH, NEW_INFERENCE_ERROR!>run {
yield() // No error but `yield` is not inside "suspension" context actually yield() // No error but `yield` is not inside "suspension" context actually
}<!>) }<!>)
} }
@@ -19,6 +19,6 @@ val test1 = generate {
yield(<!NO_COMPANION_OBJECT!>A<!>) yield(<!NO_COMPANION_OBJECT!>A<!>)
} }
val test2: Int = <!INITIALIZER_TYPE_MISMATCH!>generate { val test2: Int = <!INITIALIZER_TYPE_MISMATCH, NEW_INFERENCE_ERROR!>generate {
yield(A()) yield(A())
}<!> }<!>