[Test] Disable UNUSED_* diagnostics in tests which are not belong to contolFlowAnalysis suite

This commit is contained in:
Dmitriy Novozhilov
2021-03-29 12:14:16 +03:00
committed by TeamCityServer
parent 85949b387e
commit cd890d5833
758 changed files with 1832 additions and 3745 deletions
@@ -17,10 +17,10 @@ fun String.topLevelExtensionFun(){}
val String.topLevelExtensionProperty: Int get() = 1
open class A {
constructor(<!UNUSED_PARAMETER!>p<!>: Int) : this(<!TYPE_MISMATCH!>""<!>) {}
constructor(p: Int) : this(<!TYPE_MISMATCH!>""<!>) {}
@Deprecated("hidden", level = DeprecationLevel.HIDDEN)
constructor(<!UNUSED_PARAMETER!>s<!>: String){}
constructor(s: String){}
@Deprecated("hidden", level = DeprecationLevel.HIDDEN)
open fun memberFun(){}
@@ -71,4 +71,4 @@ class B : A(<!TYPE_MISMATCH!>""<!>) {
class C : A {
constructor() : super(<!TYPE_MISMATCH!>""<!>)
}
}
@@ -13,7 +13,7 @@ typealias YBar = <!RECURSIVE_TYPEALIAS_EXPANSION!>ZBar<!>
typealias ZBar = <!RECURSIVE_TYPEALIAS_EXPANSION!>YBar<!>
fun Foo.foo(body: Foo.() -> Unit) = body()
fun Foo.zbar(<!UNUSED_PARAMETER{OI}!>body<!>: <!RECURSIVE_TYPEALIAS_EXPANSION!>ZBar<!>.() -> Unit) = Bar().<!UNRESOLVED_REFERENCE_WRONG_RECEIVER{OI}!>body<!>()
fun Foo.zbar(body: <!RECURSIVE_TYPEALIAS_EXPANSION!>ZBar<!>.() -> Unit) = Bar().<!UNRESOLVED_REFERENCE_WRONG_RECEIVER{OI}!>body<!>()
fun test() {
Foo().foo {
@@ -1,6 +1,6 @@
package p
class X<V>(<!UNUSED_PARAMETER!>provider<!>: () -> V, <!UNUSED_PARAMETER!>trackValue<!>: Boolean) {
class X<V>(provider: () -> V, trackValue: Boolean) {
}
class B {
@@ -1,12 +0,0 @@
interface A
interface Foo {
operator fun A.invoke()
}
fun test(a: A, foo: Foo) {
a.<!UNRESOLVED_REFERENCE!>foo<!>()
}
fun test(a: Int, foo: Int.()->Unit) {
a.foo()
}
@@ -1,12 +1,13 @@
// FIR_IDENTICAL
interface A
interface Foo {
operator fun A.invoke()
}
fun test(a: A, <!UNUSED_PARAMETER!>foo<!>: Foo) {
fun test(a: A, foo: Foo) {
a.<!UNRESOLVED_REFERENCE!>foo<!>()
}
fun test(a: Int, foo: Int.()->Unit) {
a.foo()
}
}
@@ -1,27 +0,0 @@
//KT-3772 Invoke and overload resolution ambiguity
package bar
open class A {
public operator fun invoke(f: A.() -> Unit) {}
}
class B {
public operator fun invoke(f: B.() -> Unit) {}
}
open class C
val C.attr: A
get() = A()
open class D: C()
val D.attr: B
get() = B()
fun main() {
val b = D()
b.attr {} // overload resolution ambiguity
val d = b.attr
d {} // no error
}
@@ -1,12 +1,13 @@
// FIR_IDENTICAL
//KT-3772 Invoke and overload resolution ambiguity
package bar
open class A {
public operator fun invoke(<!UNUSED_PARAMETER!>f<!>: A.() -> Unit) {}
public operator fun invoke(f: A.() -> Unit) {}
}
class B {
public operator fun invoke(<!UNUSED_PARAMETER!>f<!>: B.() -> Unit) {}
public operator fun invoke(f: B.() -> Unit) {}
}
open class C
@@ -24,4 +25,4 @@ fun main() {
val d = b.attr
d {} // no error
}
}
@@ -3,7 +3,7 @@ package c
public abstract class TestBug1() {
public fun m3(<!UNUSED_PARAMETER!>position<!>: Int) {
public fun m3(position: Int) {
position(m1().second<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>)
}
@@ -13,7 +13,7 @@ public abstract class TestBug1() {
<!INCOMPATIBLE_MODIFIERS!>private<!> <!INCOMPATIBLE_MODIFIERS!>abstract<!> fun m1(): Pair<Int, Int>
private fun position(<!UNUSED_PARAMETER!>p<!>: Int) {}
private fun position(p: Int) {}
}
@@ -1,4 +1,3 @@
//KT-9517 Wrong resolve for invoke convention after smart cast
open class A {
open val foo: () -> Number = null!!
@@ -11,6 +10,6 @@ class B: A() {
fun test(a: A) {
if (a is B) {
val <!UNUSED_VARIABLE!>foo<!>: Int = <!DEBUG_INFO_SMARTCAST!>a<!>.foo() // B::foo + invoke()
val foo: Int = <!DEBUG_INFO_SMARTCAST!>a<!>.foo() // B::foo + invoke()
}
}
}
@@ -9,12 +9,12 @@ class A {
val B.a: () -> Int get() = { 5 }
fun test(a: A, b: B) {
val <!UNUSED_VARIABLE!>x<!>: Int = b.a()
val x: Int = b.a()
b.<!FUNCTION_EXPECTED!>(a)<!>()
with(b) {
val <!UNUSED_VARIABLE!>y<!>: Int = a()
val y: Int = a()
<!FUNCTION_EXPECTED!>(a)<!>()
}
}
@@ -112,7 +112,7 @@ fun testTwoLambdas() {
fun f1(): (() -> Unit) -> (() -> Unit) -> Unit {
return { l1 ->
<!TYPE_MISMATCH{NI}, TYPE_MISMATCH!>l1()
<!UNEXPECTED_TRAILING_LAMBDA_ON_A_NEW_LINE!>{ <!CANNOT_INFER_PARAMETER_TYPE, UNUSED_ANONYMOUS_PARAMETER{NI}!>l2<!> -> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE{OI}!><!DEBUG_INFO_MISSING_UNRESOLVED{NI}!>l2<!>()<!> }<!><!>
<!TYPE_MISMATCH, TYPE_MISMATCH!>l1()
<!UNEXPECTED_TRAILING_LAMBDA_ON_A_NEW_LINE!>{ <!CANNOT_INFER_PARAMETER_TYPE!>l2<!> -> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE{OI}!><!DEBUG_INFO_MISSING_UNRESOLVED{NI}!>l2<!>()<!> }<!><!>
}
}
@@ -9,7 +9,7 @@ class A
var A.timeInMillis: String
get() = ""
set(<!UNUSED_PARAMETER!>v<!>) {}
set(v) {}
fun a(c: Calendar) {
A().apply {
@@ -1,21 +0,0 @@
//If this test hangs, it means something is broken.
package a
class A {
val testVal : A = A()
}
//inappropriate but participating in resolve functions
fun <T> foo(a: T, b: T, i: Int) = a
fun foo(a: Any) = a
fun <T> foo(a: T, b: String) = a
fun <T> foo(a: T, b: T, s: String) = a
//appropriate function
fun <T> foo(a: T, b: T) = a
fun test(a: A) {
//the problem occurs if there are nested function invocations to resolve (resolve for them is repeated now)
//to copy this invocation many times (and to comment/uncomment inappropriate functions) to see the difference
foo(foo(a, foo(a, foo(a, a.testVal))), a)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
//If this test hangs, it means something is broken.
package a
@@ -6,16 +7,16 @@ class A {
}
//inappropriate but participating in resolve functions
fun <T> foo(a: T, <!UNUSED_PARAMETER!>b<!>: T, <!UNUSED_PARAMETER!>i<!>: Int) = a
fun <T> foo(a: T, b: T, i: Int) = a
fun foo(a: Any) = a
fun <T> foo(a: T, <!UNUSED_PARAMETER!>b<!>: String) = a
fun <T> foo(a: T, <!UNUSED_PARAMETER!>b<!>: T, <!UNUSED_PARAMETER!>s<!>: String) = a
fun <T> foo(a: T, b: String) = a
fun <T> foo(a: T, b: T, s: String) = a
//appropriate function
fun <T> foo(a: T, <!UNUSED_PARAMETER!>b<!>: T) = a
fun <T> foo(a: T, b: T) = a
fun test(a: A) {
//the problem occurs if there are nested function invocations to resolve (resolve for them is repeated now)
//to copy this invocation many times (and to comment/uncomment inappropriate functions) to see the difference
foo(foo(a, foo(a, foo(a, a.testVal))), a)
}
}
@@ -1,7 +1,7 @@
//If this test hangs, it means something is broken.
package c
fun z(<!UNUSED_PARAMETER!>view<!>: () -> Unit) {}
fun z(view: () -> Unit) {}
<!CONFLICTING_OVERLOADS!>fun x()<!> = z { z { z { z { z { z { z { z { } } } } } } } }
<!CONFLICTING_OVERLOADS!>fun x()<!> = z { z { z { z { z { z { z { z { } } } } } } } }
@@ -31,4 +31,4 @@ fun z(<!UNUSED_PARAMETER!>view<!>: () -> Unit) {}
<!CONFLICTING_OVERLOADS!>fun x()<!> = z { z { z { z { z { z { z { z { } } } } } } } }
<!CONFLICTING_OVERLOADS!>fun x()<!> = z { z { z { z { z { z { z { z { } } } } } } } }
class x<!CONFLICTING_OVERLOADS!>()<!> {}
class x<!CONFLICTING_OVERLOADS!>()<!> {}
@@ -1,20 +0,0 @@
//If this test hangs, it means something is broken.
package c
class A {
val testVal : A = A()
}
//inappropriate but participating in resolve functions
fun foo(a: A, b: A, i: Int) = a
fun foo(a: Any) = a
fun foo(a: A, b: Any) = a
fun foo(a: A, b: A, s: String) = a
//appropriate function
fun foo(a: A, b: A) = a
fun test(a: A) {
//the problem occurs if there are nested function invocations to resolve (resolve for them is repeated now)
//to copy this invocation many times (and to comment/uncomment inappropriate functions) to see the difference
foo(foo(a, foo(a, foo(a, a.testVal))), a)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
//If this test hangs, it means something is broken.
package c
@@ -6,15 +7,15 @@ class A {
}
//inappropriate but participating in resolve functions
fun foo(a: A, <!UNUSED_PARAMETER!>b<!>: A, <!UNUSED_PARAMETER!>i<!>: Int) = a
fun foo(a: A, b: A, i: Int) = a
fun foo(a: Any) = a
fun foo(a: A, <!UNUSED_PARAMETER!>b<!>: Any) = a
fun foo(a: A, <!UNUSED_PARAMETER!>b<!>: A, <!UNUSED_PARAMETER!>s<!>: String) = a
fun foo(a: A, b: Any) = a
fun foo(a: A, b: A, s: String) = a
//appropriate function
fun foo(a: A, <!UNUSED_PARAMETER!>b<!>: A) = a
fun foo(a: A, b: A) = a
fun test(a: A) {
//the problem occurs if there are nested function invocations to resolve (resolve for them is repeated now)
//to copy this invocation many times (and to comment/uncomment inappropriate functions) to see the difference
foo(foo(a, foo(a, foo(a, a.testVal))), a)
}
}
@@ -7,14 +7,14 @@ fun <T>id(t: T): T = t
fun doList(l: List<Int>) = l
fun doInt(i: Int) = i
fun <T> strangeNullableList(<!UNUSED_PARAMETER!>f<!>: (T) -> Unit): List<T>? = throw Exception()
fun <T> strangeNullableList(f: (T) -> Unit): List<T>? = throw Exception()
fun <T: A> emptyNullableListOfA(): List<T>? = null
//-------------------------------
fun testExclExcl() {
doList(<!TYPE_INFERENCE_UPPER_BOUND_VIOLATED{OI}!>emptyNullableListOfA<!>()!!) //should be an error here
val <!UNUSED_VARIABLE!>l<!>: List<Int> = <!TYPE_MISMATCH!><!TYPE_MISMATCH!>id<!>(<!TYPE_INFERENCE_UPPER_BOUND_VIOLATED{OI}, TYPE_MISMATCH!>emptyNullableListOfA<!>()<!TYPE_MISMATCH!>!!<!>)<!>
val l: List<Int> = <!TYPE_MISMATCH{NI}!><!TYPE_MISMATCH{NI}!>id<!>(<!TYPE_INFERENCE_UPPER_BOUND_VIOLATED{OI}, TYPE_MISMATCH{NI}!>emptyNullableListOfA<!>()<!TYPE_MISMATCH{NI}!>!!<!>)<!>
doList(strangeNullableList { doInt(it) }!!) //lambda should be analyzed (at completion phase)
}