Introduce Variable: Proper occurrence search in generated block expression
#KT-7836 Fixed #KT-8443 Fixed #EA-71411 Fixed
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
fun test(n: Int) {
|
||||
val t = if (n > 0) <selection>n + 1</selection> else n
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
fun test(n: Int) {
|
||||
val t = if (n > 0) {
|
||||
val i = n + 1
|
||||
i
|
||||
} else n
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(p: Int, list: List<Int>) {
|
||||
if (p > 0) list.filter <selection>{ it > 0 }</selection>
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo(p: Int, list: List<Int>) {
|
||||
if (p > 0) {
|
||||
val function: (Int) -> Boolean = { it > 0 }
|
||||
list.filter(function)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user