Introduce UNUSED_ANONYMOUS_PARAMETER for anonymous functions

It is not reported for 1.0 language version because
renaming to _ is not possible. It has weak warning severity

So #KT-8813 Fixed
So #KT-16875 Fixed
This commit is contained in:
Mikhail Glukhikh
2017-03-30 17:42:46 +03:00
parent 110fc103de
commit 7a53b2f4c8
65 changed files with 130 additions and 90 deletions
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !DIAGNOSTICS: -UNUSED_ANONYMOUS_PARAMETER
import kotlin.properties.Delegates
class My {
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !DIAGNOSTICS: -UNUSED_ANONYMOUS_PARAMETER
import kotlin.jvm.Volatile
import kotlin.properties.Delegates
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER -UNUSED_VARIABLE
class GenericController<T> {
suspend fun yield(t: T) {}
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !DIAGNOSTICS: -UNUSED_ANONYMOUS_PARAMETER
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !DIAGNOSTICS: -UNUSED_ANONYMOUS_PARAMETER
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !DIAGNOSTICS: -UNUSED_ANONYMOUS_PARAMETER
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
@@ -33,8 +33,8 @@ private val STRING = CompileTimeType<String>()
private val ANY = CompileTimeType<Any>()
private val emptyBinaryFun: Function2<BigInteger, BigInteger, BigInteger> = { <!UNUSED_PARAMETER!>a<!>, <!UNUSED_PARAMETER!>b<!> -> BigInteger("0") }
private val emptyUnaryFun: Function1<Long, Long> = { <!UNUSED_PARAMETER!>a<!> -> 1.toLong() }
private val emptyBinaryFun: Function2<BigInteger, BigInteger, BigInteger> = { <!UNUSED_ANONYMOUS_PARAMETER!>a<!>, <!UNUSED_ANONYMOUS_PARAMETER!>b<!> -> BigInteger("0") }
private val emptyUnaryFun: Function1<Long, Long> = { <!UNUSED_ANONYMOUS_PARAMETER!>a<!> -> 1.toLong() }
private val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?, Any>, Function1<Long, Long>>>
= hashMapOf<UnaryOperationKey<*>, Pair<Function1<Any?, Any>, Function1<Long, Long>>>(
@@ -4,7 +4,7 @@ class O : Function2<Int, String, Unit> {
}
fun test() {
val a = fun(<!UNUSED_PARAMETER!>o<!>: O) {
val a = fun(<!UNUSED_ANONYMOUS_PARAMETER!>o<!>: O) {
}
a <!TYPE_MISMATCH!>{}<!>
}