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
@@ -3,7 +3,7 @@ package a
fun <T, R, S> foo(block: (T)-> R, <!UNUSED_PARAMETER!>second<!>: (T)-> S) = block
fun main(args: Array<String>) {
val fff = { <!UNUSED_PARAMETER!>x<!>: Int -> <!UNRESOLVED_REFERENCE!>aaa<!> }
val fff = { <!UNUSED_ANONYMOUS_PARAMETER!>x<!>: Int -> <!UNRESOLVED_REFERENCE!>aaa<!> }
foo(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>fff<!>, { x -> x + 1 })
}
@@ -9,7 +9,7 @@ fun <T: Closeable, R> T.foo(block: (T, T)-> R) = block
fun main(args: Array<String>) {
C().foo { // no ambiguity here
<!UNUSED_PARAMETER!>www<!> ->
<!UNUSED_ANONYMOUS_PARAMETER!>www<!> ->
<!UNRESOLVED_REFERENCE!>xs<!>
}
}
@@ -4,7 +4,7 @@ fun <T, R> foo(block: (T)-> R) = block
fun test1() {
<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!> {
<!CANNOT_INFER_PARAMETER_TYPE, UNUSED_PARAMETER!>x<!> -> // here we have 'cannot infer parameter type' error
<!CANNOT_INFER_PARAMETER_TYPE, UNUSED_ANONYMOUS_PARAMETER!>x<!> -> // here we have 'cannot infer parameter type' error
43
}
}
@@ -12,5 +12,5 @@ fun test1() {
fun bar(<!UNUSED_PARAMETER!>f<!>: (<!UNRESOLVED_REFERENCE!>A<!>)->Unit) {}
fun test2() {
bar { <!UNUSED_PARAMETER!>a<!> -> } // here we don't have 'cannot infer parameter type' error
bar { <!UNUSED_ANONYMOUS_PARAMETER!>a<!> -> } // here we don't have 'cannot infer parameter type' error
}