UselessCallOnCollectionInspection: fix false positive when lambda last statement is function call that returns generic type

#KT-38267 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-04-24 14:58:22 +09:00
committed by igoriakovlev
parent 3c8ef5749f
commit 148f49d54a
5 changed files with 60 additions and 1 deletions
@@ -0,0 +1,13 @@
// PROBLEM: none
// WITH_RUNTIME
fun test(): List<String> {
return listOf(1, 2, 3).<caret>mapNotNull { i ->
foo {
bar(i)
}
}
}
fun <T> foo(f: () -> T): T = f()
fun bar(i: Int): String? = null