[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
@@ -1,21 +0,0 @@
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-152
* PRIMARY LINKS: expressions, when-expression -> paragraph 5 -> sentence 1
* expressions, when-expression -> paragraph 9 -> sentence 2
* expressions, when-expression, exhaustive-when-expressions -> paragraph 1 -> sentence 1
* expressions, function-literals, lambda-literals -> paragraph 10 -> sentence 1
*/
fun foo(x: Int) {
r {
when (x) {
2 -> 0
}
}
}
fun r(f: () -> Unit) {
f()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
@@ -11,7 +12,7 @@
fun foo(x: Int) {
r {
when (x) {
2 -> <!UNUSED_EXPRESSION!>0<!>
2 -> 0
}
}
}
@@ -34,7 +34,7 @@ fun foo() {
else -> {}
})
<!UNUSED_EXPRESSION!>1<!>
1
<!UNRESOLVED_REFERENCE, UNSUPPORTED!>sealed<!><!SYNTAX!><!> when {
else -> {}
}
+17 -17
View File
@@ -19,16 +19,16 @@ fun foo() : Int {
val s = ""
val x = 1
when (x) {
is <!INCOMPATIBLE_TYPES!>String<!> -> <!UNUSED_EXPRESSION!>1<!>
<!USELESS_IS_CHECK!>!is Int<!> -> <!UNUSED_EXPRESSION!>1<!>
<!USELESS_IS_CHECK!>is Any<!USELESS_NULLABLE_CHECK!>?<!><!> -> <!UNUSED_EXPRESSION!>1<!>
<!USELESS_IS_CHECK!>is Any<!> -> <!UNUSED_EXPRESSION!>1<!>
<!INCOMPATIBLE_TYPES!>s<!> -> <!UNUSED_EXPRESSION!>1<!>
1 -> <!UNUSED_EXPRESSION!>1<!>
1 + <!UNRESOLVED_REFERENCE!>a<!> -> <!UNUSED_EXPRESSION!>1<!>
in 1..<!UNRESOLVED_REFERENCE!>a<!> -> <!UNUSED_EXPRESSION!>1<!>
!in 1..<!UNRESOLVED_REFERENCE!>a<!> -> <!UNUSED_EXPRESSION!>1<!>
else -> <!UNUSED_EXPRESSION!>1<!>
is <!INCOMPATIBLE_TYPES!>String<!> -> 1
<!USELESS_IS_CHECK!>!is Int<!> -> 1
<!USELESS_IS_CHECK!>is Any<!USELESS_NULLABLE_CHECK!>?<!><!> -> 1
<!USELESS_IS_CHECK!>is Any<!> -> 1
<!INCOMPATIBLE_TYPES!>s<!> -> 1
1 -> 1
1 + <!UNRESOLVED_REFERENCE!>a<!> -> 1
in 1..<!UNRESOLVED_REFERENCE!>a<!> -> 1
!in 1..<!UNRESOLVED_REFERENCE!>a<!> -> 1
else -> 1
}
return 0
@@ -41,20 +41,20 @@ fun test() {
val s = "";
when (x) {
<!INCOMPATIBLE_TYPES!>s<!> -> <!UNUSED_EXPRESSION!>1<!>
<!DUPLICATE_LABEL_IN_WHEN, INCOMPATIBLE_TYPES!>""<!> -> <!UNUSED_EXPRESSION!>1<!>
x -> <!UNUSED_EXPRESSION!>1<!>
1 -> <!UNUSED_EXPRESSION!>1<!>
<!INCOMPATIBLE_TYPES!>s<!> -> 1
<!DUPLICATE_LABEL_IN_WHEN, INCOMPATIBLE_TYPES!>""<!> -> 1
x -> 1
1 -> 1
}
val z = 1
when (z) {
<!ELSE_MISPLACED_IN_WHEN!>else<!> -> <!UNUSED_EXPRESSION!>1<!>
<!ELSE_MISPLACED_IN_WHEN!>else<!> -> 1
<!UNREACHABLE_CODE!>1 -> 2<!>
}
when (<!UNUSED_EXPRESSION!>z<!>) {
else -> <!UNUSED_EXPRESSION!>1<!>
when (z) {
else -> 1
}
}
@@ -24,13 +24,12 @@ val test2: (String) -> Boolean =
val test3: (String) -> Boolean =
when {
true -> { <!UNUSED_ANONYMOUS_PARAMETER!>s<!> -> true }
true -> { s -> true }
else -> null!!
}
val test4: (String) -> Boolean =
when {
true -> <!TYPE_MISMATCH{NI}!>{ <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!><!UNUSED_ANONYMOUS_PARAMETER!>s1<!>, <!CANNOT_INFER_PARAMETER_TYPE, UNUSED_ANONYMOUS_PARAMETER!>s2<!><!> -> true }<!>
true -> <!TYPE_MISMATCH{NI}!>{ <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!>s1, <!CANNOT_INFER_PARAMETER_TYPE!>s2<!><!> -> true }<!>
else -> null!!
}
@@ -43,7 +43,7 @@ fun test5(x: Inv<out Any?>) {
}
fun test6(x: Inv<out String?>) {
when (val <!UNUSED_VARIABLE!>y<!> = x.data) {
when (val y = x.data) {
is String -> <!DEBUG_INFO_SMARTCAST!>x.data<!>.length // should be ok
}
}
}
@@ -1,8 +1,9 @@
// !LANGUAGE: +VariableDeclarationInWhenSubject
// !DIAGNOSTICS: +UNUSED_VARIABLE
fun foo(): Any = 42
fun test() {
when (val x = foo()) {
}
}
}
@@ -1,5 +1,5 @@
// !LANGUAGE: +VariableDeclarationInWhenSubject
// !DIAGNOSICS: +UNUSED_VARIABLE
// !DIAGNOSTICS: +UNUSED_VARIABLE
fun foo(): Any = 42