Introduce Variable: Properly convert function body to block when needed
#KT-5353
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
fun x(): Int {
|
||||
val i = 1
|
||||
return i
|
||||
}
|
||||
@@ -1 +1,6 @@
|
||||
fun x(): Int = println(<selection>1</selection>)
|
||||
fun foo(a: Int) =
|
||||
if (a > 1) {
|
||||
(<selection>a + 1</selection>) * (a - 1)
|
||||
} else {
|
||||
a * (a + 1)
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
fun x(): Int {
|
||||
val i = 1
|
||||
println(i)
|
||||
fun foo(a: Int): Int {
|
||||
val i = a + 1
|
||||
return if (a > 1) {
|
||||
i * (a - 1)
|
||||
} else {
|
||||
a * i
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user