Redundant arrow: don't report on forEach call with underscore

#KT-27209 Fixed
This commit is contained in:
Mikhail Glukhikh
2018-12-06 16:27:08 +03:00
parent c8c485d27e
commit 9aa1d1495b
5 changed files with 45 additions and 10 deletions
@@ -0,0 +1,8 @@
// PROBLEM: none
// WITH_RUNTIME
fun test() {
// We do not report "redundant arrow" here,
// because it's used to explicitly call forEach with unused lambda parameter
listOf(1, 2, 3).forEach { <caret>_ -> }
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
fun println(s: String) {}
fun test() {
listOf(1, 2, 3).forEach { <caret>it -> println(it) }
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
fun println(s: String) {}
fun test() {
listOf(1, 2, 3).forEach { println(it) }
}