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

This commit is contained in:
Dmitriy Novozhilov
2021-03-29 12:04:32 +03:00
committed by TeamCityServer
parent a9ff030c73
commit 85949b387e
22 changed files with 42 additions and 11 deletions
@@ -3,5 +3,5 @@ fun Int.gg() = null
fun ff() { fun ff() {
val a: Int = 1 val a: Int = 1
val <!UNUSED_VARIABLE!>b<!>: Int = <!TYPE_MISMATCH!>a<!UNNECESSARY_SAFE_CALL!>?.<!>gg()<!> val b: Int = <!TYPE_MISMATCH!>a<!UNNECESSARY_SAFE_CALL!>?.<!>gg()<!>
} }
@@ -1,3 +1,5 @@
// !DIAGNOSICS: +UNUSED_VARIABLE
data class D(val x: Int, val y: Int, val z: Int) data class D(val x: Int, val y: Int, val z: Int)
fun foo(): Int { fun foo(): Int {
val (<!UNUSED_VARIABLE!>x<!>, y, z) = D(1, 2, 3) val (<!UNUSED_VARIABLE!>x<!>, y, z) = D(1, 2, 3)
@@ -1,3 +1,5 @@
// !DIAGNOSICS: +UNUSED_VALUE, +UNUSED_CHANGED_VALUE, +UNUSED_PARAMETER, UNUSED_VARIABLE
package unused_variables package unused_variables
fun testSimpleCases() { fun testSimpleCases() {
@@ -1,5 +1,5 @@
// !RENDER_DIAGNOSTICS_MESSAGES // !RENDER_DIAGNOSTICS_MESSAGES
// !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE // !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE +UNUSED_VALUE
@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.LOCAL_VARIABLE) @Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.LOCAL_VARIABLE)
annotation class A annotation class A
@@ -1,5 +1,5 @@
// !RENDER_DIAGNOSTICS_MESSAGES // !RENDER_DIAGNOSTICS_MESSAGES
// !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE // !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE +UNUSED_VALUE
@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.LOCAL_VARIABLE) @Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.LOCAL_VARIABLE)
annotation class A annotation class A
@@ -1,3 +1,5 @@
// !DIAGNOSICS: +UNUSED_EXPRESSION
fun unusedExpression(s: String) { fun unusedExpression(s: String) {
s::hashCode s::hashCode
s::class s::class
@@ -1,3 +1,5 @@
// !DIAGNOSICS: +UNUSED_EXPRESSION
fun unusedExpression(s: String) { fun unusedExpression(s: String) {
<!UNUSED_EXPRESSION!>s::hashCode<!> <!UNUSED_EXPRESSION!>s::hashCode<!>
<!UNUSED_EXPRESSION!>s::class<!> <!UNUSED_EXPRESSION!>s::class<!>
@@ -1,3 +1,4 @@
// !DIAGNOSICS: +UNUSED_EXPRESSION
fun foo() { fun foo() {
} }
@@ -1,3 +1,4 @@
// !DIAGNOSICS: +UNUSED_EXPRESSION
fun foo() { fun foo() {
} }
@@ -1,3 +1,5 @@
// !DIAGNOSTICS: +UNUSED_EXPRESSION
fun unusedExpressions() { fun unusedExpressions() {
if (1 == 1) if (1 == 1)
fun(): Int {return 1} fun(): Int {return 1}
@@ -1,3 +1,5 @@
// !DIAGNOSTICS: +UNUSED_EXPRESSION
fun unusedExpressions() { fun unusedExpressions() {
if (1 == 1) if (1 == 1)
<!UNUSED_EXPRESSION!>fun(): Int {return 1}<!> <!UNUSED_EXPRESSION!>fun(): Int {return 1}<!>
@@ -1,3 +1,5 @@
// !DIAGNOSTICS: +UNUSED_EXPRESSION
val flag = true val flag = true
// type of lambda was checked by txt // type of lambda was checked by txt
@@ -1,3 +1,5 @@
// !DIAGNOSTICS: +UNUSED_EXPRESSION
val flag = true val flag = true
// type of lambda was checked by txt // type of lambda was checked by txt
@@ -1,3 +1,5 @@
// !DIAGNOSICS: +UNUSED_LAMBDA_EXPRESSION, +UNUSED_VARIABLE
fun unusedLiteral(){ fun unusedLiteral(){
<!UNUSED_LAMBDA_EXPRESSION!>{ -> <!UNUSED_LAMBDA_EXPRESSION!>{ ->
val <!UNUSED_VARIABLE!>i<!> = 1 val <!UNUSED_VARIABLE!>i<!> = 1
@@ -1,3 +1,5 @@
// !DIAGNOSICS: +UNUSED_LAMBDA_EXPRESSION
fun main() { fun main() {
"".run { "".run {
{} {}
@@ -1,3 +1,5 @@
// !DIAGNOSICS: +UNUSED_LAMBDA_EXPRESSION
fun main() { fun main() {
"".run { "".run {
<!UNUSED_LAMBDA_EXPRESSION!>{}<!> <!UNUSED_LAMBDA_EXPRESSION!>{}<!>
@@ -1,3 +1,5 @@
// !DIAGNOSICS: +UNUSED_PARAMETER
fun foo(<!UNUSED_PARAMETER!>x<!>: Int) = 1 fun foo(<!UNUSED_PARAMETER!>x<!>: Int) = 1
val y = 2 val y = 2
@@ -1,2 +1,3 @@
// !DIAGNOSICS: +UNUSED_TYPEALIAS_PARAMETER
typealias Test<T, X> = List<T> typealias Test<T, X> = List<T>
typealias Test2<T, X> = Test<T, X> typealias Test2<T, X> = Test<T, X>
@@ -1,2 +1,3 @@
// !DIAGNOSICS: +UNUSED_TYPEALIAS_PARAMETER
typealias Test<T, <!UNUSED_TYPEALIAS_PARAMETER!>X<!>> = List<T> typealias Test<T, <!UNUSED_TYPEALIAS_PARAMETER!>X<!>> = List<T>
typealias Test2<T, <!UNUSED_TYPEALIAS_PARAMETER!>X<!>> = Test<T, X> typealias Test2<T, <!UNUSED_TYPEALIAS_PARAMETER!>X<!>> = Test<T, X>
@@ -1,4 +1,5 @@
// !LANGUAGE: +VariableDeclarationInWhenSubject // !LANGUAGE: +VariableDeclarationInWhenSubject
// !DIAGNOSICS: +UNUSED_VARIABLE
fun foo(): Any = 42 fun foo(): Any = 42
@@ -1,4 +1,5 @@
// !LANGUAGE: +WarningOnMainUnusedParameter // !LANGUAGE: +WarningOnMainUnusedParameter
// !DIAGNOSTICS: +UNUSED_PARAMETER
// FILE: a.kt // FILE: a.kt
fun main(args: Array<String>) {} fun main(args: Array<String>) {}
@@ -1,4 +1,5 @@
// !LANGUAGE: +WarningOnMainUnusedParameter // !LANGUAGE: +WarningOnMainUnusedParameter
// !DIAGNOSTICS: +UNUSED_PARAMETER
// FILE: a.kt // FILE: a.kt
fun main(<!UNUSED_PARAMETER!>args<!>: Array<String>) {} fun main(<!UNUSED_PARAMETER!>args<!>: Array<String>) {}