tests: apply official code style
#KT-38632 Fixed
This commit is contained in:
+3
-3
@@ -7,8 +7,8 @@ fun foo(list: List<String>, o: Any) {
|
||||
unresolvedFun()
|
||||
|
||||
val result: Any? = list
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.firstOrNull { it > 1000 }
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.firstOrNull { it > 1000 }
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -7,9 +7,9 @@ fun foo(list: List<String>, o: Any) {
|
||||
unresolvedFun()
|
||||
|
||||
val result: Any? = list
|
||||
.asSequence()
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.firstOrNull { it > 1000 }
|
||||
.asSequence()
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.firstOrNull { it > 1000 }
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -4,10 +4,10 @@
|
||||
fun foo(list: List<String>, o: Any): Int? {
|
||||
if (o is Int) {
|
||||
return list
|
||||
.map { it.length + o }
|
||||
.filter { it > 0 }
|
||||
.map { it * o.hashCode() }
|
||||
.firstOrNull()
|
||||
.map { it.length + o }
|
||||
.filter { it > 0 }
|
||||
.map { it * o.hashCode() }
|
||||
.firstOrNull()
|
||||
}
|
||||
return 0
|
||||
}
|
||||
+5
-5
@@ -4,11 +4,11 @@
|
||||
fun foo(list: List<String>, o: Any): Int? {
|
||||
if (o is Int) {
|
||||
return list
|
||||
.asSequence()
|
||||
.map { it.length + o }
|
||||
.filter { it > 0 }
|
||||
.map { it * o.hashCode() }
|
||||
.firstOrNull()
|
||||
.asSequence()
|
||||
.map { it.length + o }
|
||||
.filter { it > 0 }
|
||||
.map { it * o.hashCode() }
|
||||
.firstOrNull()
|
||||
}
|
||||
return 0
|
||||
}
|
||||
+3
-3
@@ -4,9 +4,9 @@
|
||||
fun foo(list: List<String>, o: Any): Int? {
|
||||
if (o is CharSequence) {
|
||||
<caret>return list
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.firstOrNull { it > 1000 }
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.firstOrNull { it > 1000 }
|
||||
}
|
||||
return 0
|
||||
}
|
||||
+4
-4
@@ -4,10 +4,10 @@
|
||||
fun foo(list: List<String>, o: Any): Int? {
|
||||
if (o is CharSequence) {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.firstOrNull { it > 1000 }
|
||||
.asSequence()
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.firstOrNull { it > 1000 }
|
||||
}
|
||||
return 0
|
||||
}
|
||||
+3
-3
@@ -4,8 +4,8 @@
|
||||
fun foo(list: List<String>, o: Any) {
|
||||
if (o is CharSequence) {
|
||||
val result: Any? = list
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.firstOrNull { it > 1000 }
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.firstOrNull { it > 1000 }
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -4,9 +4,9 @@
|
||||
fun foo(list: List<String>, o: Any) {
|
||||
if (o is CharSequence) {
|
||||
val result: Any? = list
|
||||
.asSequence()
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.firstOrNull { it > 1000 }
|
||||
.asSequence()
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.firstOrNull { it > 1000 }
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -5,8 +5,8 @@ fun foo(list: List<String>, o: Any) {
|
||||
var result: Any? = ""
|
||||
if (o is CharSequence) {
|
||||
result = list
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.firstOrNull { it > 1000 }
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.firstOrNull { it > 1000 }
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -5,9 +5,9 @@ fun foo(list: List<String>, o: Any) {
|
||||
var result: Any? = ""
|
||||
if (o is CharSequence) {
|
||||
result = list
|
||||
.asSequence()
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.firstOrNull { it > 1000 }
|
||||
.asSequence()
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.firstOrNull { it > 1000 }
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -4,8 +4,8 @@
|
||||
fun foo(list: List<String>, o: Any, result: MutableCollection<Int>) {
|
||||
if (o is CharSequence) {
|
||||
list
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.filterTo(result) { it > 1000 }
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.filterTo(result) { it > 1000 }
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -4,9 +4,9 @@
|
||||
fun foo(list: List<String>, o: Any, result: MutableCollection<Int>) {
|
||||
if (o is CharSequence) {
|
||||
list
|
||||
.asSequence()
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.filterTo(result) { it > 1000 }
|
||||
.asSequence()
|
||||
.map { it.length + (o as String).capitalize().hashCode() }
|
||||
.map { it * o.length }
|
||||
.filterTo(result) { it > 1000 }
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -3,8 +3,8 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence()...filter{}.map{}.firstOrNull()'"
|
||||
fun foo(list: List<String>, o: Any): Int? {
|
||||
<caret>return list
|
||||
.map { it.length + (o as Int) }
|
||||
.filter { it > 0 }
|
||||
.map { it * o.hashCode() }
|
||||
.firstOrNull()
|
||||
.map { it.length + (o as Int) }
|
||||
.filter { it > 0 }
|
||||
.map { it * o.hashCode() }
|
||||
.firstOrNull()
|
||||
}
|
||||
+5
-5
@@ -3,9 +3,9 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence()...filter{}.map{}.firstOrNull()'"
|
||||
fun foo(list: List<String>, o: Any): Int? {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.map { it.length + (o as Int) }
|
||||
.filter { it > 0 }
|
||||
.map { it * o.hashCode() }
|
||||
.firstOrNull()
|
||||
.asSequence()
|
||||
.map { it.length + (o as Int) }
|
||||
.filter { it > 0 }
|
||||
.map { it * o.hashCode() }
|
||||
.firstOrNull()
|
||||
}
|
||||
+4
-4
@@ -3,8 +3,8 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence()...filter{}.map{}.firstOrNull()'"
|
||||
fun foo(list: List<Any>, o: Any): Int? {
|
||||
return list
|
||||
.filterIsInstance<String>()
|
||||
.filter { it.length > 0 }
|
||||
.map { it.length * 2 }
|
||||
.firstOrNull()
|
||||
.filterIsInstance<String>()
|
||||
.filter { it.length > 0 }
|
||||
.map { it.length * 2 }
|
||||
.firstOrNull()
|
||||
}
|
||||
+5
-5
@@ -3,9 +3,9 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence()...filter{}.map{}.firstOrNull()'"
|
||||
fun foo(list: List<Any>, o: Any): Int? {
|
||||
return list
|
||||
.asSequence()
|
||||
.filterIsInstance<String>()
|
||||
.filter { it.length > 0 }
|
||||
.map { it.length * 2 }
|
||||
.firstOrNull()
|
||||
.asSequence()
|
||||
.filterIsInstance<String>()
|
||||
.filter { it.length > 0 }
|
||||
.map { it.length * 2 }
|
||||
.firstOrNull()
|
||||
}
|
||||
Reference in New Issue
Block a user