Introduce "flatMap { it } -> flatten" inspection #KT-25969 Fixed

This commit is contained in:
Toshiaki Kameyama
2018-08-09 17:25:56 +03:00
committed by Mikhail Glukhikh
parent cdcc588a55
commit 2c71b3873e
20 changed files with 201 additions and 0 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.collections.ConvertFlatMapToFlattenInspection
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
listOf(listOf(1)).<caret>flatMap { i -> i }
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
listOf(listOf(1)).flatten()
}
@@ -0,0 +1,5 @@
// PROBLEM: none
// WITH_RUNTIME
fun test() {
listOf(listOf(1)).flatMap<caret> { it + 1 }
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
setOf(setOf(1)).<caret>flatMap { it }
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
setOf(setOf(1)).flatten()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
listOf(listOf(1)).flatMap<caret> { it }
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
listOf(listOf(1)).flatten()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
listOf(listOf(1)).flatMap<caret>({ it })
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
listOf(listOf(1)).flatten()
}