KotlinIntroduceVariableHandler: fix for declarations with expression body

#KT-38449 Fixed
This commit is contained in:
Dmitry Gridin
2020-04-22 21:15:03 +07:00
parent d21e383094
commit 8e35b7a29c
11 changed files with 62 additions and 13 deletions
@@ -0,0 +1,7 @@
fun b(body: () -> Int) = body()
class A {
fun test() = b {
<selection>24</selection>
}
}
@@ -0,0 +1,10 @@
fun b(body: () -> Int) = body()
class A {
fun test(): Int {
val i = 24
return b {
i
}
}
}
@@ -0,0 +1,7 @@
fun b(body: () -> Unit): Unit = body()
class A {
fun test() = b {
<selection>24</selection>
}
}
@@ -0,0 +1,10 @@
fun b(body: () -> Unit): Unit = body()
class A {
fun test() {
val i = 24
b {
i
}
}
}