Intentions: Fix insertion of necessary lambda parameter for run/let and apply/also conversions

#KT-22931 Fixed
This commit is contained in:
Alexey Sedunov
2018-05-29 20:59:21 +03:00
parent f17053f970
commit fbb4914bfb
6 changed files with 63 additions and 15 deletions
@@ -0,0 +1,11 @@
// WITH_RUNTIME
// FIX: Convert to 'also'
class Employee(val firstName: String, val manager: Employee?)
fun test(employee: Employee) {
val person = employee.also {
it.manager?.<caret>apply {
println("${it.firstName} has a manager")
}
}
}
@@ -0,0 +1,11 @@
// WITH_RUNTIME
// FIX: Convert to 'also'
class Employee(val firstName: String, val manager: Employee?)
fun test(employee: Employee) {
val person = employee.also {
it.manager?.<caret>also { employee1 ->
println("${it.firstName} has a manager")
}
}
}
@@ -0,0 +1,11 @@
// WITH_RUNTIME
// FIX: Convert to 'let'
class Employee(val firstName: String, val manager: Employee?)
fun test(employee: Employee) {
val person = employee.also {
it.manager?.<caret>run {
println("${it.firstName} has a manager")
}
}
}
@@ -0,0 +1,11 @@
// WITH_RUNTIME
// FIX: Convert to 'let'
class Employee(val firstName: String, val manager: Employee?)
fun test(employee: Employee) {
val person = employee.also {
it.manager?.<caret>let { employee1 ->
println("${it.firstName} has a manager")
}
}
}