[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
@@ -19,7 +19,7 @@ fun foo(): String? {
if (true)
return@run
else
if (true) <!UNUSED_EXPRESSION!>42<!>
if (true) 42
}
run {
@@ -39,4 +39,4 @@ fun foo(): String? {
}
return ""
}
}
@@ -1,14 +0,0 @@
// SKIP_TXT
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !LANGUAGE: +NewInference
fun foo(f: () -> Unit) {}
fun bar(): Int = 42
fun test() {
foo {
::bar // should be fine
}
foo {
{ "something" } // should be fine
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// SKIP_TXT
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !LANGUAGE: +NewInference
@@ -6,9 +7,9 @@ fun foo(f: () -> Unit) {}
fun bar(): Int = 42
fun test() {
foo {
<!UNUSED_EXPRESSION!>::bar<!> // should be fine
::bar // should be fine
}
foo {
<!UNUSED_LAMBDA_EXPRESSION!>{ "something" }<!> // should be fine
{ "something" } // should be fine
}
}
@@ -29,7 +29,7 @@ fun test(i: Inv<Nothing>, iUnit: Inv<Unit>) {
run<Nothing?> { null }
}
launch {
run { <!UNUSED_EXPRESSION!>null<!> }
run { null }
}
launch {
run(i) { TODO() }
@@ -38,16 +38,16 @@ fun test(i: Inv<Nothing>, iUnit: Inv<Unit>) {
run(A.flexible(i)) { TODO() }
}
launch {
run(A.flexible(iUnit)) { <!UNUSED_EXPRESSION!>42<!> }
run(A.flexible(iUnit)) { 42 }
}
launch {
@Suppress("UNSUPPORTED")
run<dynamic> { <!UNUSED_EXPRESSION!>""<!> }
run<dynamic> { "" }
}
if (iUnit is <!INCOMPATIBLE_TYPES!>String<!>) {
launch {
run(A.flexible(iUnit)) { <!UNUSED_EXPRESSION!>42<!> }
run(A.flexible(iUnit)) { 42 }
}
}
}
@@ -8,7 +8,7 @@ val a: () -> Unit = l@{
// Expected type here is Unit, but it also implies coercion,
// so we can end lambda body with statement
if (true) <!UNUSED_EXPRESSION!>42<!>
if (true) 42
}
val b: () -> Unit = l@{
@@ -16,7 +16,7 @@ val b: () -> Unit = l@{
if (true) return@l <!TYPE_MISMATCH!>"hello"<!>
// However, this is OK, because here coercion is applied
<!UNUSED_EXPRESSION!>"hello"<!>
"hello"
}
val c: () -> Unit = {
@@ -3,16 +3,16 @@
fun <T> materialize(): T = TODO()
fun implicitCoercion() {
val <!UNUSED_VARIABLE!>a<!> = {
val a = {
// Block is implicitly Unit-coerced, so it is allowed to place statement at the end of lambda
if (true) <!UNUSED_EXPRESSION!>42<!>
if (true) 42
}
val <!UNUSED_VARIABLE!>b<!> = l@{
val b = l@{
return@l
}
val <!UNUSED_VARIABLE!>c<!> = l@{
val c = l@{
// Error: block doesn't have an expected type, so call can't be inferred!
return@l <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER{NI}, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>materialize<!>()
}
@@ -5,7 +5,7 @@ fun <T> materialize(): T = TODO()
fun a(): Unit = run {
run {
// Ok, block is coerced, because it has (indirectly) Unit-expected type
<!UNUSED_EXPRESSION{NI}!>"hello"<!>
"hello"
}
}
@@ -48,7 +48,7 @@ fun bar(block: () -> String) {}
fun test_5(b: Boolean) {
bar {
<!TYPE_MISMATCH{NI}, TYPE_MISMATCH!>if (b) {
<!TYPE_MISMATCH, TYPE_MISMATCH!>if (b) {
println("meh")
}<!>
}
@@ -10,17 +10,17 @@ fun noCoercionLastExpressionUsedAsReturnArgument() {
}
fun noCoercionBlockHasExplicitType() {
val <!UNUSED_VARIABLE!>b<!>: () -> Int = {
<!TYPE_MISMATCH!>if (true) <!UNUSED_EXPRESSION!>42<!><!>
val b: () -> Int = {
<!TYPE_MISMATCH!>if (true) 42<!>
}
}
fun noCoercionBlockHasExplicitReturn() {
val <!UNUSED_VARIABLE!>c<!> = l@{
val c = l@{
if (true) return@l 42
<!INVALID_IF_AS_EXPRESSION!>if<!> (true) 239
}
}
fun noCoercionInExpressionBody(): Unit = <!TYPE_MISMATCH!>"hello"<!>
fun noCoercionInExpressionBody(): Unit = <!TYPE_MISMATCH!>"hello"<!>