SimplifiableCallChainInspection: don't report if suspend function cannot be called correctly

#KT-23934 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-01-29 14:15:57 +09:00
committed by Yan Zhulanow
parent 1e9bb00744
commit b008e6c9be
7 changed files with 60 additions and 3 deletions
@@ -0,0 +1,8 @@
// PROBLEM: none
// WITH_RUNTIME
suspend fun mapString(input: String): String = ""
suspend fun main() {
val x = listOf("1", "2", "3").<caret>map { mapString(it) }.joinToString()
}
@@ -0,0 +1,9 @@
// PROBLEM: none
// WITH_RUNTIME
suspend fun mapString(input: String): String = ""
suspend fun main() {
val sb = StringBuilder()
val x = listOf("1", "2", "3").<caret>map { mapString(it) }.joinTo(sb)
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
suspend fun mapString(input: String): String? = ""
suspend fun main() {
val x = listOf("1", "2", "3").<caret>map { mapString(it) }.filterNotNull()
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
suspend fun mapString(input: String): String? = ""
suspend fun main() {
val x = listOf("1", "2", "3").mapNotNull { mapString(it) }
}