diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/collections/ConvertCallChainIntoSequenceInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/collections/ConvertCallChainIntoSequenceInspection.kt index d8ac79de19e..13b4a6a39e4 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/collections/ConvertCallChainIntoSequenceInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/collections/ConvertCallChainIntoSequenceInspection.kt @@ -23,6 +23,7 @@ import org.jetbrains.kotlin.psi.psiUtil.anyDescendantOfType import org.jetbrains.kotlin.psi.psiUtil.siblings import org.jetbrains.kotlin.psi.psiUtil.startOffset import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe +import org.jetbrains.kotlin.types.KotlinType class ConvertCallChainIntoSequenceInspection : AbstractKotlinInspection() { override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean) = @@ -54,8 +55,7 @@ private class ConvertCallChainIntoSequenceFix : LocalQuickFix { val lastCall = calls.lastOrNull() ?: return val first = firstCall.parent as? KtQualifiedExpression ?: return val last = lastCall.parent as? KtQualifiedExpression ?: return - val next = last.parent as? KtQualifiedExpression - val nextType = next?.getCallableDescriptor()?.returnType + val endWithTermination = lastCall.isTermination() val psiFactory = KtPsiFactory(expression) val dot = buildString { @@ -76,11 +76,7 @@ private class ConvertCallChainIntoSequenceFix : LocalQuickFix { ) firstCommentSaver.restore(firstReplaced) - val nextDescriptor = next?.getCallableDescriptor() - if (nextDescriptor == null - || !nextDescriptor.fqNameSafe.asString().startsWith("kotlin.sequences.") - || nextDescriptor.returnType != nextType - ) { + if (!endWithTermination) { val lastCommentSaver = CommentSaver(last) val lastReplaced = last.replace( psiFactory.buildExpression { @@ -100,9 +96,10 @@ private fun KtQualifiedExpression.findTarget(): Pair arg.anyDescendantOfType { it.labelQualifier == null } } -private fun KtCallExpression.isTransformation(): Boolean { - val fqName = transformations[calleeExpression?.text] ?: return false +private fun KtCallExpression.isTransformationOrTermination(): Boolean { + val fqName = transformationAndTerminations[calleeExpression?.text] ?: return false + return fqName == getCallableDescriptor()?.fqNameSafe +} + +private fun KtCallExpression.isTermination(): Boolean { + val fqName = terminations[calleeExpression?.text] ?: return false return fqName == getCallableDescriptor()?.fqNameSafe } @@ -167,5 +172,76 @@ private val transformations = listOf( "take", "takeWhile", "windowed", + "withIndex", "zipWithNext" ).associate { it to FqName("kotlin.collections.$it") } + +private val terminations = listOf( + "all", + "any", + "asIterable", + "asSequence", + "associate", + "associateBy", + "associateByTo", + "associateTo", + "average", + "contains", + "count", + "elementAt", + "elementAtOrElse", + "elementAtOrNull", + "filterIndexedTo", + "filterIsInstanceTo", + "filterNotNullTo", + "filterNotTo", + "filterTo", + "find", + "findLast", + "first", + "firstOrNull", + "fold", + "foldIndexed", + "groupBy", + "groupByTo", + "groupingBy", + "indexOf", + "indexOfFirst", + "indexOfLast", + "joinTo", + "joinToString", + "last", + "lastIndexOf", + "lastOrNull", + "mapIndexedNotNullTo", + "mapIndexedTo", + "mapNotNullTo", + "mapTo", + "max", + "maxBy", + "maxWith", + "min", + "minBy", + "minWith", + "none", + "partition", + "reduce", + "reduceIndexed", + "single", + "singleOrNull", + "sum", + "sumBy", + "sumByDouble", + "toCollection", + "toHashSet", + "toList", + "toMutableList", + "toMutableSet", + "toSet", + "toSortedSet" +).associate { + val pkg = if (it in listOf("contains", "indexOf", "lastIndexOf")) "kotlin.collections.List" else "kotlin.collections" + it to FqName("$pkg.$it") +} + +private val transformationAndTerminations = transformations + terminations diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/all.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/allTransformations.kt similarity index 89% rename from idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/all.kt rename to idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/allTransformations.kt index 82621315f0f..1564d5be2ed 100644 --- a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/all.kt +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/allTransformations.kt @@ -1,6 +1,6 @@ // WITH_RUNTIME -fun test(list: List): List, List>> { +fun test(list: List): List>, IndexedValue>>> { return list .chunked(1) .distinct() @@ -30,6 +30,7 @@ fun test(list: List): List, List>> { .take(1) .takeWhile { true } .windowed(1, 1, true) + .withIndex() .zipWithNext() .zipWithNext { a, b -> a } } \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/all.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/allTransformations.kt.after similarity index 89% rename from idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/all.kt.after rename to idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/allTransformations.kt.after index fc6aeb1424e..c6e332b3f36 100644 --- a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/all.kt.after +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/allTransformations.kt.after @@ -1,6 +1,6 @@ // WITH_RUNTIME -fun test(list: List): List, List>> { +fun test(list: List): List>, IndexedValue>>> { return list .asSequence() .chunked(1) @@ -31,6 +31,7 @@ fun test(list: List): List, List>> { .take(1) .takeWhile { true } .windowed(1, 1, true) + .withIndex() .zipWithNext() .zipWithNext { a, b -> a } .toList() diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/mutableList.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/mutableList.kt new file mode 100644 index 00000000000..d4efa1e084a --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/mutableList.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(): List { + return mutableListOf(1, 2, 3).filter { it > 1 }.map { it * 2 } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/mutableList.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/mutableList.kt.after new file mode 100644 index 00000000000..31d5d771c0c --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/mutableList.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(): List { + return mutableListOf(1, 2, 3).asSequence().filter { it > 1 }.map { it * 2 }.toList() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/mutableSet.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/mutableSet.kt new file mode 100644 index 00000000000..65dbaed86da --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/mutableSet.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(): List { + return mutableSetOf(1, 2, 3).filter { it > 1 }.map { it * 2 } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/mutableSet.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/mutableSet.kt.after new file mode 100644 index 00000000000..60665d2f7a2 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/mutableSet.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(): List { + return mutableSetOf(1, 2, 3).asSequence().filter { it > 1 }.map { it * 2 }.toList() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetCallChain2.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetCallChain2.kt index 8e4f63c0a99..945f8fab138 100644 --- a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetCallChain2.kt +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetCallChain2.kt @@ -2,5 +2,8 @@ // WITH_RUNTIME fun test(list: List): List { - return list.filter { it > 2 }.dropLast(1).filter { it > 2 } + return list + .filter { it > 2 } + .dropLast(1) + .filter { it > 2 } } \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetCallChain3.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetCallChain3.kt index 6c85c7e8863..3985562e198 100644 --- a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetCallChain3.kt +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetCallChain3.kt @@ -4,7 +4,6 @@ fun test(list: List): List { return list .reversed() - .map { it + 1 } .map { it + 1 } .dropLast(1) .takeLast(2) diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination4.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetTermination.kt similarity index 100% rename from idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination4.kt rename to idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetTermination.kt diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination4.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetTermination.kt.after similarity index 100% rename from idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination4.kt.after rename to idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetTermination.kt.after diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination3.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetTermination2.kt similarity index 100% rename from idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination3.kt rename to idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetTermination2.kt diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination3.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetTermination2.kt.after similarity index 100% rename from idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination3.kt.after rename to idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetTermination2.kt.after diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/set.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/set.kt new file mode 100644 index 00000000000..d4e25db9fc9 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/set.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(): List { + return setOf(1, 2, 3).filter { it > 1 }.map { it * 2 } +} diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/set.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/set.kt.after new file mode 100644 index 00000000000..a20547d4f62 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/set.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(): List { + return setOf(1, 2, 3).asSequence().filter { it > 1 }.map { it * 2 }.toList() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination.kt deleted file mode 100644 index 1bfa7cc3b87..00000000000 --- a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination.kt +++ /dev/null @@ -1,8 +0,0 @@ -// WITH_RUNTIME - -fun test(): Int { - return listOf(1, 2, 3) - .filter { it > 1 } - .map { it * 2 } - .sum() -} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination.kt.after deleted file mode 100644 index d06c7b7a9fa..00000000000 --- a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination.kt.after +++ /dev/null @@ -1,9 +0,0 @@ -// WITH_RUNTIME - -fun test(): Int { - return listOf(1, 2, 3) - .asSequence() - .filter { it > 1 } - .map { it * 2 } - .sum() -} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/all.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/all.kt new file mode 100644 index 00000000000..4e6a133d6a2 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/all.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val all: Boolean = list.filter { it > 1 }.all { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/all.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/all.kt.after new file mode 100644 index 00000000000..6728ebb3711 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/all.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val all: Boolean = list.asSequence().filter { it > 1 }.all { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/any.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/any.kt new file mode 100644 index 00000000000..b7683f47cf6 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/any.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val any: Boolean = list.filter { it > 1 }.any() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/any.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/any.kt.after new file mode 100644 index 00000000000..70286e1c706 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/any.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val any: Boolean = list.asSequence().filter { it > 1 }.any() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/asIterable.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/asIterable.kt new file mode 100644 index 00000000000..cbf7410e43a --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/asIterable.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val asIterable: Iterable = list.filter { it > 1 }.asIterable() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/asIterable.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/asIterable.kt.after new file mode 100644 index 00000000000..9332f1b249f --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/asIterable.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val asIterable: Iterable = list.asSequence().filter { it > 1 }.asIterable() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/asSequence.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/asSequence.kt new file mode 100644 index 00000000000..b6a90b373c0 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/asSequence.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val asSequence: Sequence = list.filter { it > 1 }.asSequence() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/asSequence.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/asSequence.kt.after new file mode 100644 index 00000000000..d1ea6f63cb3 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/asSequence.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val asSequence: Sequence = list.asSequence().filter { it > 1 }.asSequence() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiate.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiate.kt new file mode 100644 index 00000000000..ad89469557b --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiate.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val associate: Map = list.filter { it > 1 }.associate { it to it } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiate.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiate.kt.after new file mode 100644 index 00000000000..4c18aa342d1 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiate.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val associate: Map = list.asSequence().filter { it > 1 }.associate { it to it } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateBy.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateBy.kt new file mode 100644 index 00000000000..652e57c5eb7 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateBy.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val associateBy: Map = list.filter { it > 1 }.associateBy { it } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateBy.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateBy.kt.after new file mode 100644 index 00000000000..3ace57d0ba9 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateBy.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val associateBy: Map = list.asSequence().filter { it > 1 }.associateBy { it } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateByTo.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateByTo.kt new file mode 100644 index 00000000000..a6cd0327656 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateByTo.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val associateByTo = list.filter { it > 1 }.associateByTo(mutableMapOf()) { it } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateByTo.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateByTo.kt.after new file mode 100644 index 00000000000..ec5a8ec1ac8 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateByTo.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val associateByTo = list.asSequence().filter { it > 1 }.associateByTo(mutableMapOf()) { it } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateTo.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateTo.kt new file mode 100644 index 00000000000..8531f1797e4 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateTo.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val associateTo: MutableMap = list.filter { it > 1 }.associateTo(mutableMapOf()) { it to it } +} diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateTo.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateTo.kt.after new file mode 100644 index 00000000000..288cc04c841 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateTo.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val associateTo: MutableMap = list.asSequence().filter { it > 1 }.associateTo(mutableMapOf()) { it to it } +} diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/average.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/average.kt new file mode 100644 index 00000000000..91424dc63bc --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/average.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val average: Double = list.filter { it > 1 }.average() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/average.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/average.kt.after new file mode 100644 index 00000000000..e7895e3c95d --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/average.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val average: Double = list.asSequence().filter { it > 1 }.average() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/contains.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/contains.kt new file mode 100644 index 00000000000..f7aa5824741 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/contains.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val contains: Boolean = list.filter { it > 1 }.contains(1) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/contains.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/contains.kt.after new file mode 100644 index 00000000000..63a8bf453c9 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/contains.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val contains: Boolean = list.asSequence().filter { it > 1 }.contains(1) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/count.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/count.kt new file mode 100644 index 00000000000..ece4bbfec98 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/count.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val count: Int = list.filter { it > 1 }.count() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/count.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/count.kt.after new file mode 100644 index 00000000000..140ef381e3a --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/count.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val count: Int = list.asSequence().filter { it > 1 }.count() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAt.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAt.kt new file mode 100644 index 00000000000..e80efbf7b48 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAt.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val elementAt = list.filter { it > 1 }.elementAt(1) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAt.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAt.kt.after new file mode 100644 index 00000000000..a8b5a9cc802 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAt.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val elementAt = list.asSequence().filter { it > 1 }.elementAt(1) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAtOrElse.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAtOrElse.kt new file mode 100644 index 00000000000..7768c339c8e --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAtOrElse.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val elementAtOrElse: Int = list.filter { it > 1 }.elementAtOrElse(1) { 1 } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAtOrElse.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAtOrElse.kt.after new file mode 100644 index 00000000000..963822fd5bb --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAtOrElse.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val elementAtOrElse: Int = list.asSequence().filter { it > 1 }.elementAtOrElse(1) { 1 } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAtOrNull.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAtOrNull.kt new file mode 100644 index 00000000000..dcef7b7ea6a --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAtOrNull.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val elementAtOrNull: Int? = list.filter { it > 1 }.elementAtOrNull(1) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAtOrNull.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAtOrNull.kt.after new file mode 100644 index 00000000000..49fe9f2c941 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAtOrNull.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val elementAtOrNull: Int? = list.asSequence().filter { it > 1 }.elementAtOrNull(1) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterIndexedTo.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterIndexedTo.kt new file mode 100644 index 00000000000..cba61998527 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterIndexedTo.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val filterIndexedTo: MutableList = list.filter { it > 1 }.filterIndexedTo(mutableListOf()) { index, it -> true } +} diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterIndexedTo.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterIndexedTo.kt.after new file mode 100644 index 00000000000..d19813ca1f7 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterIndexedTo.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val filterIndexedTo: MutableList = list.asSequence().filter { it > 1 }.filterIndexedTo(mutableListOf()) { index, it -> true } +} diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterIsInstanceTo.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterIsInstanceTo.kt new file mode 100644 index 00000000000..43e330ec13f --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterIsInstanceTo.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val filterIsInstanceTo = list.filter { it > 1 }.filterIsInstanceTo(mutableListOf()) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterIsInstanceTo.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterIsInstanceTo.kt.after new file mode 100644 index 00000000000..bbcfc998040 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterIsInstanceTo.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val filterIsInstanceTo = list.asSequence().filter { it > 1 }.filterIsInstanceTo(mutableListOf()) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterNotNullTo.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterNotNullTo.kt new file mode 100644 index 00000000000..077ad077ff1 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterNotNullTo.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val filterNotNullTo: MutableList = list.filter { it > 1 }.filterNotNullTo(mutableListOf()) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterNotNullTo.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterNotNullTo.kt.after new file mode 100644 index 00000000000..3db1f764a70 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterNotNullTo.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val filterNotNullTo: MutableList = list.asSequence().filter { it > 1 }.filterNotNullTo(mutableListOf()) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterNotTo.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterNotTo.kt new file mode 100644 index 00000000000..164fd7e4394 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterNotTo.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val filterNotTo: MutableList = list.filter { it > 1 }.filterNotTo(mutableListOf()) { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterNotTo.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterNotTo.kt.after new file mode 100644 index 00000000000..4de662049c1 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterNotTo.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val filterNotTo: MutableList = list.asSequence().filter { it > 1 }.filterNotTo(mutableListOf()) { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterTo.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterTo.kt new file mode 100644 index 00000000000..afe97184d0a --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterTo.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val filterTo: MutableList = list.filter { it > 1 }.filterTo(mutableListOf()) { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterTo.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterTo.kt.after new file mode 100644 index 00000000000..855ae6827b0 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterTo.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val filterTo: MutableList = list.asSequence().filter { it > 1 }.filterTo(mutableListOf()) { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/find.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/find.kt new file mode 100644 index 00000000000..7d76f3fdd1d --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/find.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val find: Int? = list.filter { it > 1 }.find { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/find.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/find.kt.after new file mode 100644 index 00000000000..69036a34f13 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/find.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val find: Int? = list.asSequence().filter { it > 1 }.find { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/findLast.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/findLast.kt new file mode 100644 index 00000000000..86019ff0c82 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/findLast.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val findLast: Int? = list.filter { it > 1 }.findLast { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/findLast.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/findLast.kt.after new file mode 100644 index 00000000000..128b1951447 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/findLast.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val findLast: Int? = list.asSequence().filter { it > 1 }.findLast { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/first.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/first.kt new file mode 100644 index 00000000000..647e9395e65 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/first.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val first: Int = list.filter { it > 1 }.first() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/first.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/first.kt.after new file mode 100644 index 00000000000..21e977bec94 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/first.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val first: Int = list.asSequence().filter { it > 1 }.first() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/firstOrNull.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/firstOrNull.kt new file mode 100644 index 00000000000..529d0e95cf1 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/firstOrNull.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val firstOrNull: Int? = list.filter { it > 1 }.firstOrNull() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/firstOrNull.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/firstOrNull.kt.after new file mode 100644 index 00000000000..c0395c80b7b --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/firstOrNull.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val firstOrNull: Int? = list.asSequence().filter { it > 1 }.firstOrNull() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/fold.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/fold.kt new file mode 100644 index 00000000000..11c0fe2816f --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/fold.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val fold: Int = list.filter { it > 1 }.fold(0) { acc, i -> acc + i } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/fold.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/fold.kt.after new file mode 100644 index 00000000000..ffac153f435 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/fold.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val fold: Int = list.asSequence().filter { it > 1 }.fold(0) { acc, i -> acc + i } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/foldIndexed.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/foldIndexed.kt new file mode 100644 index 00000000000..59737d884ca --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/foldIndexed.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val foldIndexed = list.filter { it > 1 }.foldIndexed(0) { index, acc, i -> acc + i } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/foldIndexed.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/foldIndexed.kt.after new file mode 100644 index 00000000000..9e5c645f1fd --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/foldIndexed.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val foldIndexed = list.asSequence().filter { it > 1 }.foldIndexed(0) { index, acc, i -> acc + i } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/forEach.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/forEach.kt new file mode 100644 index 00000000000..0e584b43dc8 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/forEach.kt @@ -0,0 +1,6 @@ +// PROBLEM: none +// WITH_RUNTIME + +fun test(list: List) { + val forEach: Unit = list.filter { it > 1 }.forEach { } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/forEachIndexed.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/forEachIndexed.kt new file mode 100644 index 00000000000..67aab3156e9 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/forEachIndexed.kt @@ -0,0 +1,6 @@ +// PROBLEM: none +// WITH_RUNTIME + +fun test(list: List) { + val forEachIndexed: Unit = list.filter { it > 1 }.forEachIndexed { index, i -> } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupBy.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupBy.kt new file mode 100644 index 00000000000..3cbabc85968 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupBy.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val groupBy = list.filter { it > 1 }.groupBy { it } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupBy.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupBy.kt.after new file mode 100644 index 00000000000..16692d48a37 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupBy.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val groupBy = list.asSequence().filter { it > 1 }.groupBy { it } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupByTo.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupByTo.kt new file mode 100644 index 00000000000..a65b0df220c --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupByTo.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val groupByTo: MutableMap> = list.filter { it > 1 }.groupByTo(mutableMapOf()) { it } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupByTo.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupByTo.kt.after new file mode 100644 index 00000000000..2c4018e95e0 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupByTo.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val groupByTo: MutableMap> = list.asSequence().filter { it > 1 }.groupByTo(mutableMapOf()) { it } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupingBy.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupingBy.kt new file mode 100644 index 00000000000..bb2a13c8deb --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupingBy.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val groupingBy: Grouping = list.filter { it > 1 }.groupingBy { it } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupingBy.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupingBy.kt.after new file mode 100644 index 00000000000..d3d24984a32 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupingBy.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val groupingBy: Grouping = list.asSequence().filter { it > 1 }.groupingBy { it } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOf.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOf.kt new file mode 100644 index 00000000000..2c05d205c98 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOf.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val indexOf: Int = list.filter { it > 1 }.indexOf(1) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOf.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOf.kt.after new file mode 100644 index 00000000000..af15c1fd05a --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOf.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val indexOf: Int = list.asSequence().filter { it > 1 }.indexOf(1) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOfFirst.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOfFirst.kt new file mode 100644 index 00000000000..fa1febe2d70 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOfFirst.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val indexOfFirst: Int = list.filter { it > 1 }.indexOfFirst { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOfFirst.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOfFirst.kt.after new file mode 100644 index 00000000000..581aa49d879 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOfFirst.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val indexOfFirst: Int = list.asSequence().filter { it > 1 }.indexOfFirst { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOfLast.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOfLast.kt new file mode 100644 index 00000000000..063e58de3d5 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOfLast.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val indexOfLast: Int = list.filter { it > 1 }.indexOfLast { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOfLast.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOfLast.kt.after new file mode 100644 index 00000000000..5c151606413 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOfLast.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val indexOfLast: Int = list.asSequence().filter { it > 1 }.indexOfLast { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/joinTo.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/joinTo.kt new file mode 100644 index 00000000000..a2506bcba2b --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/joinTo.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val joinTo: StringBuilder = list.filter { it > 1 }.joinTo(StringBuilder()) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/joinTo.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/joinTo.kt.after new file mode 100644 index 00000000000..18870c2a752 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/joinTo.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val joinTo: StringBuilder = list.asSequence().filter { it > 1 }.joinTo(StringBuilder()) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/joinToString.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/joinToString.kt new file mode 100644 index 00000000000..1edfd97539d --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/joinToString.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val joinToString: String = list.filter { it > 1 }.joinToString() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/joinToString.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/joinToString.kt.after new file mode 100644 index 00000000000..8620386c9f0 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/joinToString.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val joinToString: String = list.asSequence().filter { it > 1 }.joinToString() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/last.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/last.kt new file mode 100644 index 00000000000..1dc7c38e922 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/last.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val last: Int = list.filter { it > 1 }.last() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/last.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/last.kt.after new file mode 100644 index 00000000000..37bb298a9a9 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/last.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val last: Int = list.asSequence().filter { it > 1 }.last() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/lastIndexOf.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/lastIndexOf.kt new file mode 100644 index 00000000000..e8bea9fa18c --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/lastIndexOf.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val lastIndexOf: Int = list.filter { it > 1 }.lastIndexOf(1) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/lastIndexOf.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/lastIndexOf.kt.after new file mode 100644 index 00000000000..7df945e78fe --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/lastIndexOf.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val lastIndexOf: Int = list.asSequence().filter { it > 1 }.lastIndexOf(1) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/lastOrNull.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/lastOrNull.kt new file mode 100644 index 00000000000..2fdf06aae4e --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/lastOrNull.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val lastOrNull = list.filter { it > 1 }.lastOrNull() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/lastOrNull.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/lastOrNull.kt.after new file mode 100644 index 00000000000..1504193ffb6 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/lastOrNull.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val lastOrNull = list.asSequence().filter { it > 1 }.lastOrNull() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapIndexedNotNullTo.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapIndexedNotNullTo.kt new file mode 100644 index 00000000000..59167b30c1d --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapIndexedNotNullTo.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val mapIndexedNotNullTo: MutableList = list.filter { it > 1 }.mapIndexedNotNullTo(mutableListOf()) { index, i -> i } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapIndexedNotNullTo.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapIndexedNotNullTo.kt.after new file mode 100644 index 00000000000..ddc54c28a9c --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapIndexedNotNullTo.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val mapIndexedNotNullTo: MutableList = list.asSequence().filter { it > 1 }.mapIndexedNotNullTo(mutableListOf()) { index, i -> i } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapIndexedTo.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapIndexedTo.kt new file mode 100644 index 00000000000..c442ac1bc6e --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapIndexedTo.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val mapIndexedTo: MutableList = list.filter { it > 1 }.mapIndexedTo(mutableListOf()) { index, i -> i } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapIndexedTo.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapIndexedTo.kt.after new file mode 100644 index 00000000000..aa72796f498 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapIndexedTo.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val mapIndexedTo: MutableList = list.asSequence().filter { it > 1 }.mapIndexedTo(mutableListOf()) { index, i -> i } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapNotNullTo.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapNotNullTo.kt new file mode 100644 index 00000000000..bbd2835d8d8 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapNotNullTo.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val mapNotNullTo: MutableList = list.filter { it > 1 }.mapNotNullTo(mutableListOf()) { it } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapNotNullTo.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapNotNullTo.kt.after new file mode 100644 index 00000000000..ea0aab0ed96 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapNotNullTo.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val mapNotNullTo: MutableList = list.asSequence().filter { it > 1 }.mapNotNullTo(mutableListOf()) { it } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapTo.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapTo.kt new file mode 100644 index 00000000000..7207d9490ab --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapTo.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val mapTo: MutableList = list.filter { it > 1 }.mapTo(mutableListOf()) { it } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapTo.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapTo.kt.after new file mode 100644 index 00000000000..0c9a56f2c43 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapTo.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val mapTo: MutableList = list.asSequence().filter { it > 1 }.mapTo(mutableListOf()) { it } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/max.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/max.kt new file mode 100644 index 00000000000..e152af388c0 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/max.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val max: Int? = list.filter { it > 1 }.max() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/max.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/max.kt.after new file mode 100644 index 00000000000..6ad160a99b6 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/max.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val max: Int? = list.asSequence().filter { it > 1 }.max() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/maxBy.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/maxBy.kt new file mode 100644 index 00000000000..1b74e45fa62 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/maxBy.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val maxBy: Int? = list.filter { it > 1 }.maxBy { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/maxBy.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/maxBy.kt.after new file mode 100644 index 00000000000..0112fae93c1 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/maxBy.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val maxBy: Int? = list.asSequence().filter { it > 1 }.maxBy { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/maxWith.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/maxWith.kt new file mode 100644 index 00000000000..5f6acdb36e4 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/maxWith.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val maxWith: Int? = list.filter { it > 1 }.maxWith(Comparator { o1, o2 -> 0 }) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/maxWith.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/maxWith.kt.after new file mode 100644 index 00000000000..441726c64c1 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/maxWith.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val maxWith: Int? = list.asSequence().filter { it > 1 }.maxWith(Comparator { o1, o2 -> 0 }) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/min.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/min.kt new file mode 100644 index 00000000000..3e3e672d4f5 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/min.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val min: Int? = list.filter { it > 1 }.min() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/min.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/min.kt.after new file mode 100644 index 00000000000..30389533241 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/min.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val min: Int? = list.asSequence().filter { it > 1 }.min() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/minBy.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/minBy.kt new file mode 100644 index 00000000000..0d3b08fe608 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/minBy.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val minBy: Int? = list.filter { it > 1 }.minBy { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/minBy.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/minBy.kt.after new file mode 100644 index 00000000000..56ec242ebd3 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/minBy.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val minBy: Int? = list.asSequence().filter { it > 1 }.minBy { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/minWith.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/minWith.kt new file mode 100644 index 00000000000..5f6acdb36e4 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/minWith.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val maxWith: Int? = list.filter { it > 1 }.maxWith(Comparator { o1, o2 -> 0 }) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/minWith.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/minWith.kt.after new file mode 100644 index 00000000000..441726c64c1 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/minWith.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val maxWith: Int? = list.asSequence().filter { it > 1 }.maxWith(Comparator { o1, o2 -> 0 }) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/none.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/none.kt new file mode 100644 index 00000000000..cbadda6532f --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/none.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val none: Boolean = list.filter { it > 1 }.none() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/none.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/none.kt.after new file mode 100644 index 00000000000..fc606898a5a --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/none.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val none: Boolean = list.asSequence().filter { it > 1 }.none() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/partition.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/partition.kt new file mode 100644 index 00000000000..911f2456b21 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/partition.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val partition: Pair, List> = list.filter { it > 1 }.partition { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/partition.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/partition.kt.after new file mode 100644 index 00000000000..63719f7b378 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/partition.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val partition: Pair, List> = list.asSequence().filter { it > 1 }.partition { true } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/reduce.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/reduce.kt new file mode 100644 index 00000000000..36dbe138056 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/reduce.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val reduce: Int = list.filter { it > 1 }.reduce { acc, i -> acc + i } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/reduce.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/reduce.kt.after new file mode 100644 index 00000000000..42d5da82cc5 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/reduce.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val reduce: Int = list.asSequence().filter { it > 1 }.reduce { acc, i -> acc + i } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/reduceIndexed.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/reduceIndexed.kt new file mode 100644 index 00000000000..19a7cc5aefa --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/reduceIndexed.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val reduceIndexed: Int = list.filter { it > 1 }.reduceIndexed { index, acc, i -> acc + i } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/reduceIndexed.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/reduceIndexed.kt.after new file mode 100644 index 00000000000..00689752e11 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/reduceIndexed.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val reduceIndexed: Int = list.asSequence().filter { it > 1 }.reduceIndexed { index, acc, i -> acc + i } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/single.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/single.kt new file mode 100644 index 00000000000..4cf9b82afbd --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/single.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val single: Int = list.filter { it > 1 }.single() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/single.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/single.kt.after new file mode 100644 index 00000000000..45f2b78059b --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/single.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val single: Int = list.asSequence().filter { it > 1 }.single() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/singleOrNull.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/singleOrNull.kt new file mode 100644 index 00000000000..c94bf8cf3bf --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/singleOrNull.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val singleOrNull: Int? = list.filter { it > 1 }.singleOrNull() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/singleOrNull.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/singleOrNull.kt.after new file mode 100644 index 00000000000..ba3c3c54126 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/singleOrNull.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val singleOrNull: Int? = list.asSequence().filter { it > 1 }.singleOrNull() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sum.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sum.kt new file mode 100644 index 00000000000..d14cff8d0b1 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sum.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val sum: Int = list.filter { it > 1 }.sum() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sum.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sum.kt.after new file mode 100644 index 00000000000..412437582bf --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sum.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val sum: Int = list.asSequence().filter { it > 1 }.sum() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sumBy.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sumBy.kt new file mode 100644 index 00000000000..1b12d814c45 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sumBy.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val sumBy: Int = list.filter { it > 1 }.sumBy { it } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sumBy.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sumBy.kt.after new file mode 100644 index 00000000000..c1523cffadb --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sumBy.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val sumBy: Int = list.asSequence().filter { it > 1 }.sumBy { it } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sumByDouble.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sumByDouble.kt new file mode 100644 index 00000000000..1605b62bd33 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sumByDouble.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val sumByDouble: Double = list.filter { it > 1 }.sumByDouble { it.toDouble() } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sumByDouble.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sumByDouble.kt.after new file mode 100644 index 00000000000..269152888bf --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sumByDouble.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val sumByDouble: Double = list.asSequence().filter { it > 1 }.sumByDouble { it.toDouble() } +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toCollection.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toCollection.kt new file mode 100644 index 00000000000..0bfb5f529bc --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toCollection.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val toCollection: MutableList = list.filter { it > 1 }.toCollection(mutableListOf()) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toCollection.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toCollection.kt.after new file mode 100644 index 00000000000..1256a976a8a --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toCollection.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val toCollection: MutableList = list.asSequence().filter { it > 1 }.toCollection(mutableListOf()) +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toHashSet.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toHashSet.kt new file mode 100644 index 00000000000..257da6b768e --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toHashSet.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val toHashSet: HashSet = list.filter { it > 1 }.toHashSet() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toHashSet.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toHashSet.kt.after new file mode 100644 index 00000000000..464368149f3 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toHashSet.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val toHashSet: HashSet = list.asSequence().filter { it > 1 }.toHashSet() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toList.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toList.kt new file mode 100644 index 00000000000..03c1e36f413 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toList.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val toList: List = list.filter { it > 1 }.toList() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toList.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toList.kt.after new file mode 100644 index 00000000000..38769f9de80 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toList.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val toList: List = list.asSequence().filter { it > 1 }.toList() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toMutableList.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toMutableList.kt new file mode 100644 index 00000000000..51d9b88c752 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toMutableList.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val toMutableList = list.filter { it > 1 }.toMutableList() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toMutableList.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toMutableList.kt.after new file mode 100644 index 00000000000..5042abf5bf9 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toMutableList.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val toMutableList = list.asSequence().filter { it > 1 }.toMutableList() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toMutableSet.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toMutableSet.kt new file mode 100644 index 00000000000..899f6aea385 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toMutableSet.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val toMutableSet = list.filter { it > 1 }.toMutableSet() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toMutableSet.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toMutableSet.kt.after new file mode 100644 index 00000000000..5efcf8ab267 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toMutableSet.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val toMutableSet = list.asSequence().filter { it > 1 }.toMutableSet() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toSet.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toSet.kt new file mode 100644 index 00000000000..1efd3677b71 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toSet.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val toSet: Set = list.filter { it > 1 }.toSet() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toSet.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toSet.kt.after new file mode 100644 index 00000000000..aa620e4c2dd --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toSet.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val toSet: Set = list.asSequence().filter { it > 1 }.toSet() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toSortedSet.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toSortedSet.kt new file mode 100644 index 00000000000..b03fc4d9304 --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toSortedSet.kt @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val toSortedSet = list.filter { it > 1 }.toSortedSet() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toSortedSet.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toSortedSet.kt.after new file mode 100644 index 00000000000..52f4dd175ce --- /dev/null +++ b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toSortedSet.kt.after @@ -0,0 +1,5 @@ +// WITH_RUNTIME + +fun test(list: List) { + val toSortedSet = list.asSequence().filter { it > 1 }.toSortedSet() +} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination2.kt b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination2.kt deleted file mode 100644 index 29780cae6b9..00000000000 --- a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination2.kt +++ /dev/null @@ -1,8 +0,0 @@ -// WITH_RUNTIME - -fun test(): Int { - return listOf(1, 2, 3) - .filter { it > 1 } - .map { it * 2 } - .binarySearch(4) -} \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination2.kt.after b/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination2.kt.after deleted file mode 100644 index 3fa8a1a757e..00000000000 --- a/idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination2.kt.after +++ /dev/null @@ -1,10 +0,0 @@ -// WITH_RUNTIME - -fun test(): Int { - return listOf(1, 2, 3) - .asSequence() - .filter { it > 1 } - .map { it * 2 } - .toList() - .binarySearch(4) -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java index c0644e8e21e..8494f27981d 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java @@ -500,15 +500,15 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest { KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); } - @TestMetadata("all.kt") - public void testAll() throws Exception { - runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/all.kt"); - } - public void testAllFilesPresentInConvertCallChainIntoSequence() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); } + @TestMetadata("allTransformations.kt") + public void testAllTransformations() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/allTransformations.kt"); + } + @TestMetadata("comment.kt") public void testComment() throws Exception { runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/comment.kt"); @@ -519,6 +519,16 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest { runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/comment2.kt"); } + @TestMetadata("mutableList.kt") + public void testMutableList() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/mutableList.kt"); + } + + @TestMetadata("mutableSet.kt") + public void testMutableSet() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/mutableSet.kt"); + } + @TestMetadata("noTargetCallChain.kt") public void testNoTargetCallChain() throws Exception { runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetCallChain.kt"); @@ -534,6 +544,16 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest { runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetCallChain3.kt"); } + @TestMetadata("noTargetTermination.kt") + public void testNoTargetTermination() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetTermination.kt"); + } + + @TestMetadata("noTargetTermination2.kt") + public void testNoTargetTermination2() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/noTargetTermination2.kt"); + } + @TestMetadata("nullable.kt") public void testNullable() throws Exception { runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/nullable.kt"); @@ -554,6 +574,11 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest { runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/returnAtLabels.kt"); } + @TestMetadata("set.kt") + public void testSet() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/set.kt"); + } + @TestMetadata("simple.kt") public void testSimple() throws Exception { runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/simple.kt"); @@ -574,24 +599,337 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest { runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/simple4.kt"); } - @TestMetadata("termination.kt") - public void testTermination() throws Exception { - runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination.kt"); - } + @TestMetadata("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Termination extends AbstractLocalInspectionTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } - @TestMetadata("termination2.kt") - public void testTermination2() throws Exception { - runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination2.kt"); - } + @TestMetadata("all.kt") + public void testAll() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/all.kt"); + } - @TestMetadata("termination3.kt") - public void testTermination3() throws Exception { - runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination3.kt"); - } + public void testAllFilesPresentInTermination() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); + } - @TestMetadata("termination4.kt") - public void testTermination4() throws Exception { - runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination4.kt"); + @TestMetadata("any.kt") + public void testAny() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/any.kt"); + } + + @TestMetadata("asIterable.kt") + public void testAsIterable() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/asIterable.kt"); + } + + @TestMetadata("asSequence.kt") + public void testAsSequence() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/asSequence.kt"); + } + + @TestMetadata("assosiate.kt") + public void testAssosiate() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiate.kt"); + } + + @TestMetadata("assosiateBy.kt") + public void testAssosiateBy() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateBy.kt"); + } + + @TestMetadata("assosiateByTo.kt") + public void testAssosiateByTo() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateByTo.kt"); + } + + @TestMetadata("assosiateTo.kt") + public void testAssosiateTo() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/assosiateTo.kt"); + } + + @TestMetadata("average.kt") + public void testAverage() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/average.kt"); + } + + @TestMetadata("contains.kt") + public void testContains() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/contains.kt"); + } + + @TestMetadata("count.kt") + public void testCount() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/count.kt"); + } + + @TestMetadata("elementAt.kt") + public void testElementAt() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAt.kt"); + } + + @TestMetadata("elementAtOrElse.kt") + public void testElementAtOrElse() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAtOrElse.kt"); + } + + @TestMetadata("elementAtOrNull.kt") + public void testElementAtOrNull() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/elementAtOrNull.kt"); + } + + @TestMetadata("filterIndexedTo.kt") + public void testFilterIndexedTo() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterIndexedTo.kt"); + } + + @TestMetadata("filterIsInstanceTo.kt") + public void testFilterIsInstanceTo() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterIsInstanceTo.kt"); + } + + @TestMetadata("filterNotNullTo.kt") + public void testFilterNotNullTo() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterNotNullTo.kt"); + } + + @TestMetadata("filterNotTo.kt") + public void testFilterNotTo() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterNotTo.kt"); + } + + @TestMetadata("filterTo.kt") + public void testFilterTo() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/filterTo.kt"); + } + + @TestMetadata("find.kt") + public void testFind() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/find.kt"); + } + + @TestMetadata("findLast.kt") + public void testFindLast() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/findLast.kt"); + } + + @TestMetadata("first.kt") + public void testFirst() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/first.kt"); + } + + @TestMetadata("firstOrNull.kt") + public void testFirstOrNull() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/firstOrNull.kt"); + } + + @TestMetadata("fold.kt") + public void testFold() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/fold.kt"); + } + + @TestMetadata("foldIndexed.kt") + public void testFoldIndexed() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/foldIndexed.kt"); + } + + @TestMetadata("forEach.kt") + public void testForEach() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/forEach.kt"); + } + + @TestMetadata("forEachIndexed.kt") + public void testForEachIndexed() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/forEachIndexed.kt"); + } + + @TestMetadata("groupBy.kt") + public void testGroupBy() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupBy.kt"); + } + + @TestMetadata("groupByTo.kt") + public void testGroupByTo() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupByTo.kt"); + } + + @TestMetadata("groupingBy.kt") + public void testGroupingBy() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/groupingBy.kt"); + } + + @TestMetadata("indexOf.kt") + public void testIndexOf() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOf.kt"); + } + + @TestMetadata("indexOfFirst.kt") + public void testIndexOfFirst() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOfFirst.kt"); + } + + @TestMetadata("indexOfLast.kt") + public void testIndexOfLast() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/indexOfLast.kt"); + } + + @TestMetadata("joinTo.kt") + public void testJoinTo() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/joinTo.kt"); + } + + @TestMetadata("joinToString.kt") + public void testJoinToString() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/joinToString.kt"); + } + + @TestMetadata("last.kt") + public void testLast() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/last.kt"); + } + + @TestMetadata("lastIndexOf.kt") + public void testLastIndexOf() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/lastIndexOf.kt"); + } + + @TestMetadata("lastOrNull.kt") + public void testLastOrNull() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/lastOrNull.kt"); + } + + @TestMetadata("mapIndexedNotNullTo.kt") + public void testMapIndexedNotNullTo() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapIndexedNotNullTo.kt"); + } + + @TestMetadata("mapIndexedTo.kt") + public void testMapIndexedTo() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapIndexedTo.kt"); + } + + @TestMetadata("mapNotNullTo.kt") + public void testMapNotNullTo() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapNotNullTo.kt"); + } + + @TestMetadata("mapTo.kt") + public void testMapTo() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/mapTo.kt"); + } + + @TestMetadata("max.kt") + public void testMax() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/max.kt"); + } + + @TestMetadata("maxBy.kt") + public void testMaxBy() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/maxBy.kt"); + } + + @TestMetadata("maxWith.kt") + public void testMaxWith() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/maxWith.kt"); + } + + @TestMetadata("min.kt") + public void testMin() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/min.kt"); + } + + @TestMetadata("minBy.kt") + public void testMinBy() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/minBy.kt"); + } + + @TestMetadata("minWith.kt") + public void testMinWith() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/minWith.kt"); + } + + @TestMetadata("none.kt") + public void testNone() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/none.kt"); + } + + @TestMetadata("partition.kt") + public void testPartition() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/partition.kt"); + } + + @TestMetadata("reduce.kt") + public void testReduce() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/reduce.kt"); + } + + @TestMetadata("reduceIndexed.kt") + public void testReduceIndexed() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/reduceIndexed.kt"); + } + + @TestMetadata("single.kt") + public void testSingle() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/single.kt"); + } + + @TestMetadata("singleOrNull.kt") + public void testSingleOrNull() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/singleOrNull.kt"); + } + + @TestMetadata("sum.kt") + public void testSum() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sum.kt"); + } + + @TestMetadata("sumBy.kt") + public void testSumBy() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sumBy.kt"); + } + + @TestMetadata("sumByDouble.kt") + public void testSumByDouble() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/sumByDouble.kt"); + } + + @TestMetadata("toCollection.kt") + public void testToCollection() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toCollection.kt"); + } + + @TestMetadata("toHashSet.kt") + public void testToHashSet() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toHashSet.kt"); + } + + @TestMetadata("toList.kt") + public void testToList() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toList.kt"); + } + + @TestMetadata("toMutableList.kt") + public void testToMutableList() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toMutableList.kt"); + } + + @TestMetadata("toMutableSet.kt") + public void testToMutableSet() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toMutableSet.kt"); + } + + @TestMetadata("toSet.kt") + public void testToSet() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toSet.kt"); + } + + @TestMetadata("toSortedSet.kt") + public void testToSortedSet() throws Exception { + runTest("idea/testData/inspectionsLocal/collections/convertCallChainIntoSequence/termination/toSortedSet.kt"); + } } }