Report warning on unused entities that can be renamed to _
Currently it's all about lambda parameters/destructuring entries #KT-14347 In Progress
This commit is contained in:
Vendored
+1
-1
@@ -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 = { x: Int -> <!UNRESOLVED_REFERENCE!>aaa<!> }
|
||||
val fff = { <!UNUSED_PARAMETER!>x<!>: Int -> <!UNRESOLVED_REFERENCE!>aaa<!> }
|
||||
foo(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>fff<!>, { x -> x + 1 })
|
||||
}
|
||||
|
||||
|
||||
+1
-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
|
||||
www ->
|
||||
<!UNUSED_PARAMETER!>www<!> ->
|
||||
<!UNRESOLVED_REFERENCE!>xs<!>
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -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!>x<!> -> // here we have 'cannot infer parameter type' error
|
||||
<!CANNOT_INFER_PARAMETER_TYPE, UNUSED_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 { a -> } // here we don't have 'cannot infer parameter type' error
|
||||
}
|
||||
bar { <!UNUSED_PARAMETER!>a<!> -> } // here we don't have 'cannot infer parameter type' error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user