ConvertCallChainIntoSequence: support functions added in Kotlin 1.4

#KT-40448 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-07-20 17:07:33 +09:00
committed by igoriakovlev
parent 5e91ffb156
commit 4901cdb11f
50 changed files with 371 additions and 3 deletions
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.maxByOrNull { true }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.maxByOrNull { true }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.maxOf { it }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.maxOf { it }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.maxOfOrNull { it }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.maxOfOrNull { it }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.maxOfWith({ _, _ -> 0 }) { it }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.maxOfWith({ _, _ -> 0 }) { it }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.maxOfWithOrNull({ _, _ -> 0 }) { it }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.maxOfWithOrNull({ _, _ -> 0 }) { it }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.maxOrNull()
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.maxOrNull()
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.maxWithOrNull { _, _ -> 0 }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.maxWithOrNull { _, _ -> 0 }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.minByOrNull { true }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.minByOrNull { true }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.minOf { it }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.minOf { it }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.minOfOrNull { it }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.minOfOrNull { it }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.minOfWith({ _, _ -> 0 }) { it }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.minOfWith({ _, _ -> 0 }) { it }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.minOfWithOrNull({ _, _ -> 0 }) { it }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.minOfWithOrNull({ _, _ -> 0 }) { it }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.minOrNull()
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.minOrNull()
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.minWithOrNull { _, _ -> 0 }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.minWithOrNull { _, _ -> 0 }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.reduceIndexedOrNull { _, acc, i -> acc + i }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.reduceIndexedOrNull { _, acc, i -> acc + i }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.reduceOrNull { acc, i -> acc + i }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.reduceOrNull { acc, i -> acc + i }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.runningFold(0) { acc, i -> acc + i }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.runningFold(0) { acc, i -> acc + i }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.runningFoldIndexed(0) { _, acc, i -> acc + i }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.runningFoldIndexed(0) { _, acc, i -> acc + i }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.runningReduce { acc, i -> acc + i }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.runningReduce { acc, i -> acc + i }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.runningReduceIndexed { _, acc, i -> acc + i }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.runningReduceIndexed { _, acc, i -> acc + i }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.scan(0) { acc, i -> acc + i }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.scan(0) { acc, i -> acc + i }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.scanIndexed(0) { _, acc, i -> acc + i }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.scanIndexed(0) { _, acc, i -> acc + i }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.<caret>filter { it > 1 }.sumOf { it }
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test(list: List<Int>) {
list.asSequence().filter { it > 1 }.sumOf { it }
}