Inline Variable: Var support

#KT-5169 Fixed
This commit is contained in:
Alexey Sedunov
2015-09-28 19:28:12 +03:00
parent 007c7c17f0
commit e3d8d819da
9 changed files with 70 additions and 18 deletions
-4
View File
@@ -1,4 +0,0 @@
fun f() {
var v = 239
println(<caret>v)
}
@@ -1,3 +1,4 @@
// ERROR: Cannot perform refactoring.\nCannot find a single definition to inline
fun f() {
val v = if (true) a else b
println(<caret>v++)
@@ -1,3 +0,0 @@
fun f() {
println((if (true) a else b)++)
}
+4
View File
@@ -0,0 +1,4 @@
fun foo() {
var x = 1
val t = <caret>x + 1
}
+3
View File
@@ -0,0 +1,3 @@
fun foo() {
val t = 1 + 1
}
+6
View File
@@ -0,0 +1,6 @@
// ERROR: Cannot perform refactoring.\nCannot find a single definition to inline
fun foo() {
var x = 1
val t = <caret>x + 1
x = 2
}
+6
View File
@@ -0,0 +1,6 @@
// ERROR: Cannot perform refactoring.\nCannot find a single definition to inline
fun foo() {
var x = 1
val t = <caret>x + 1
x++
}