Call chain into sequence: add 'flatten' to conversion targets #KT-26969 Fixed

This commit is contained in:
Toshiaki Kameyama
2018-10-11 12:34:37 +09:00
committed by Mikhail Glukhikh
parent bd27460694
commit 3f252b15e1
6 changed files with 27 additions and 0 deletions
@@ -219,6 +219,7 @@ private val transformations = listOf(
"filterIsInstance",
"filterNot",
"filterNotNull",
"flatten",
"map",
"mapIndexed",
"mapIndexedNotNull",
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
listOf(listOf(1), listOf(2)).<caret>flatten().filter { it > 1 }
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
listOf(listOf(1), listOf(2)).asSequence().flatten().filter { it > 1 }.toList()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
listOf(listOf(1), listOf(2, 3)).<caret>filter { it.size > 1 }.flatten()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
listOf(listOf(1), listOf(2, 3)).asSequence().filter { it.size > 1 }.flatten().toList()
}
@@ -569,6 +569,16 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/endsWithGroupingBy.kt");
}
@TestMetadata("flatten.kt")
public void testFlatten() throws Exception {
runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/flatten.kt");
}
@TestMetadata("flatten2.kt")
public void testFlatten2() throws Exception {
runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/flatten2.kt");
}
@TestMetadata("implicitReceiver.kt")
public void testImplicitReceiver() throws Exception {
runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/implicitReceiver.kt");