Inspection for scope functions conversion
#KT-17047 Fixed
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
val x = hashSetOf("abc").<caret>apply {
|
||||
forEach {
|
||||
forEach {
|
||||
println(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
val x = hashSetOf("abc").also { hashSet ->
|
||||
hashSet.forEach {
|
||||
hashSet.forEach {
|
||||
println(hashSet)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
// FIX: Convert to 'also'
|
||||
|
||||
val x = "".also {
|
||||
"".<caret>apply {
|
||||
this.length + it.length
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
// FIX: Convert to 'also'
|
||||
|
||||
val x = "".also {
|
||||
"".also { s ->
|
||||
s.length + it.length
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
val x = hashSetOf("abc").<caret>apply {
|
||||
forEach {
|
||||
println(this)
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
val x = hashSetOf("abc").also { hashSet ->
|
||||
hashSet.forEach {
|
||||
println(hashSet)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
// FIX: Convert to 'also'
|
||||
|
||||
val x = hashSetOf<String>().<caret>apply {
|
||||
add("x")
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
// FIX: Convert to 'also'
|
||||
|
||||
val x = hashSetOf<String>().<caret>also {
|
||||
it.add("x")
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
// FIX: Convert to 'also'
|
||||
|
||||
val x = "".<caret>apply {
|
||||
"".apply {
|
||||
this.length
|
||||
length
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
// FIX: Convert to 'also'
|
||||
|
||||
val x = "".<caret>also {
|
||||
"".apply {
|
||||
this.length
|
||||
length
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
// FIX: Convert to 'also'
|
||||
|
||||
val x = "".<caret>apply {
|
||||
this.length
|
||||
length
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
// FIX: Convert to 'also'
|
||||
|
||||
val x = "".<caret>also {
|
||||
it.length
|
||||
it.length
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
// FIX: Convert to 'also'
|
||||
|
||||
class C {
|
||||
val x = hashSetOf<C>().<caret>apply {
|
||||
add(this@C)
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
// FIX: Convert to 'also'
|
||||
|
||||
class C {
|
||||
val x = hashSetOf<C>().<caret>also {
|
||||
it.add(this)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user