Inline Variable/Property: Move test data

This commit is contained in:
Alexey Sedunov
2016-07-15 13:11:20 +03:00
parent 8bdc88f763
commit 7773a1c4e0
171 changed files with 494 additions and 485 deletions
@@ -0,0 +1,4 @@
fun f() {
val v = 239
println(<caret>v)
}
@@ -0,0 +1,3 @@
fun f() {
println(239)
}
@@ -0,0 +1,4 @@
fun f() {
val <caret>v = 239
println(v)
}
@@ -0,0 +1,3 @@
fun f() {
println(239)
}
@@ -0,0 +1,6 @@
fun f() {
run {
val v = 239
println(<caret>v)
}
}
@@ -0,0 +1,5 @@
fun f() {
run {
println(239)
}
}
@@ -0,0 +1,4 @@
fun f() {
val m = ::println
println(<caret>m)
}
@@ -0,0 +1,3 @@
fun f() {
println(::println)
}
@@ -0,0 +1,12 @@
// ERROR: Cannot perform refactoring.\nCannot find a single definition to inline
fun f() {
val v: Int
if (true) {
v = 239
}
else {
v = 30
}
println(<caret>v)
}
@@ -0,0 +1,5 @@
fun f() {
val v = 239
println(v)
println(<caret>v + v)
}
@@ -0,0 +1,4 @@
fun f() {
println(239)
println(239 + 239)
}
@@ -0,0 +1,3 @@
fun f(val p: Int) {
println(<caret>p)
}
@@ -0,0 +1,5 @@
fun f() {
val v: Int
v = 239
println(<caret>v)
}
@@ -0,0 +1,3 @@
fun f() {
println(239)
}
@@ -0,0 +1,8 @@
fun f() {
val v: Int
try {
v = 239
} finally {
}
println(<caret>v)
}
@@ -0,0 +1,6 @@
fun f() {
try {
} finally {
}
println(239)
}
@@ -0,0 +1,4 @@
fun f() {
val v = 239
vv = <caret>v
}
@@ -0,0 +1,3 @@
fun f() {
vv = 239
}
@@ -0,0 +1,6 @@
// ERROR: Cannot perform refactoring.\nVariable v has no initializer
fun f() {
val v: Int
println(<caret>v)
}
@@ -0,0 +1,4 @@
fun f() {
val v = s1 + s2
println(<caret>v[1])
}
@@ -0,0 +1,3 @@
fun f() {
println((s1 + s2)[1])
}
@@ -0,0 +1,4 @@
fun f() {
val v = foo()
println(<caret>v[1])
}
@@ -0,0 +1,3 @@
fun f() {
println(foo()[1])
}
@@ -0,0 +1,4 @@
fun f() {
val v = 150 + 150
println(<caret>v * 1)
}
@@ -0,0 +1,3 @@
fun f() {
println((150 + 150) * 1)
}
@@ -0,0 +1,4 @@
fun f() {
val v = 150 * 2
println(<caret>v + 0)
}
@@ -0,0 +1,3 @@
fun f() {
println(150 * 2 + 0)
}
@@ -0,0 +1,4 @@
fun f() {
val v = -predicate
println(<caret>v())
}
@@ -0,0 +1,3 @@
fun f() {
println((-predicate)())
}
@@ -0,0 +1,4 @@
fun f() {
val v = foo[1]
println(<caret>v())
}
@@ -0,0 +1,3 @@
fun f() {
println(foo[1]())
}
@@ -0,0 +1,4 @@
fun foo(x : String, y : () -> String.() -> Unit) {
val <caret>f = y()
x.f()
}
@@ -0,0 +1,3 @@
fun foo(x : String, y : () -> String.() -> Unit) {
x.(y())()
}
@@ -0,0 +1,4 @@
fun f() {
val v = -1
println(<caret>v: Int)
}
@@ -0,0 +1,3 @@
fun f() {
println(-1: Int)
}
@@ -0,0 +1,4 @@
fun f() {
val v = 2 + 3
println(if (true) 1 else <caret>v)
}
@@ -0,0 +1,3 @@
fun f() {
println(if (true) 1 else 2 + 3)
}
@@ -0,0 +1,4 @@
fun f() {
val v = if (true) a else b
println(<caret>v[0])
}
@@ -0,0 +1,3 @@
fun f() {
println((if (true) a else b)[0])
}
@@ -0,0 +1,7 @@
import java.util.ArrayList
fun f() {
val a = ArrayList<Int>()
val v = if (true) 1 else 2
println(a[<caret>v])
}
@@ -0,0 +1,6 @@
import java.util.ArrayList
fun f() {
val a = ArrayList<Int>()
println(a[if (true) 1 else 2])
}
@@ -0,0 +1,4 @@
fun f() {
val v = if (true) 1 else 2
println(<caret>v * 1)
}
@@ -0,0 +1,3 @@
fun f() {
println((if (true) 1 else 2) * 1)
}
@@ -0,0 +1,4 @@
fun f() {
val v = if (true) 1 else 2
println(1 * <caret>v)
}
@@ -0,0 +1,3 @@
fun f() {
println(1 * if (true) 1 else 2)
}
@@ -0,0 +1,4 @@
fun f() {
val v = if (true) 1 else 2
println(1 * <caret>v + 2)
}
@@ -0,0 +1,3 @@
fun f() {
println(1 * (if (true) 1 else 2) + 2)
}
@@ -0,0 +1,4 @@
fun f() {
val v = if (true) 1 else 2
println((1 * <caret>v) + 2)
}
@@ -0,0 +1,3 @@
fun f() {
println((1 * if (true) 1 else 2) + 2)
}
@@ -0,0 +1,5 @@
// ERROR: Cannot perform refactoring.\nCannot find a single definition to inline
fun f() {
val v = if (true) a else b
println(<caret>v++)
}
@@ -0,0 +1,4 @@
fun f() {
val v = if (true) a else b
println(+<caret>v)
}
@@ -0,0 +1,3 @@
fun f() {
println(+if (true) a else b)
}
@@ -0,0 +1,4 @@
fun f() {
val v = foo()
println(<caret>v is String)
}
@@ -0,0 +1,3 @@
fun f() {
println(foo() is String)
}
@@ -0,0 +1,4 @@
fun f() {
val v = "" is String
println(<caret>v.toString())
}
@@ -0,0 +1,3 @@
fun f() {
println(("" is String).toString())
}
@@ -0,0 +1,4 @@
fun f() {
val v = a - b
println(c - <caret>v)
}
@@ -0,0 +1,3 @@
fun f() {
println(c - (a - b))
}
@@ -0,0 +1,4 @@
fun f() {
val v = a && b
println(c && <caret>v)
}
@@ -0,0 +1,3 @@
fun f() {
println(c && a && b)
}
@@ -0,0 +1,4 @@
fun f() {
val v = 150 - 150
println(<caret>v + 1)
}
@@ -0,0 +1,3 @@
fun f() {
println(150 - 150 + 1)
}
@@ -0,0 +1,4 @@
fun f() {
val v = y++
println(-<caret>v)
}
@@ -0,0 +1,3 @@
fun f() {
println(-y++)
}
@@ -0,0 +1,4 @@
fun f() {
val v = -y
println(<caret>v!!)
}
@@ -0,0 +1,3 @@
fun f() {
println((-y)!!)
}
@@ -0,0 +1,4 @@
fun f() {
val v = 150 + 150
println(<caret>v.toString())
}
@@ -0,0 +1,3 @@
fun f() {
println((150 + 150).toString())
}
@@ -0,0 +1,4 @@
fun f() {
val v = foo()
println(<caret>v.toString())
}
@@ -0,0 +1,3 @@
fun f() {
println(foo().toString())
}
@@ -0,0 +1,4 @@
fun f() {
val v = 150 + 150
println("value is $<caret>v")
}
@@ -0,0 +1,3 @@
fun f() {
println("value is ${150 + 150}")
}
@@ -0,0 +1,4 @@
fun f() {
val v = 150 + 150
println("value is ${<caret>v}")
}
@@ -0,0 +1,3 @@
fun f() {
println("value is ${150 + 150}")
}
@@ -0,0 +1,4 @@
fun f() {
val v = otherValue
println("value is $<caret>v")
}
@@ -0,0 +1,3 @@
fun f() {
println("value is $otherValue")
}
@@ -0,0 +1,5 @@
fun f() {
// this case is not processed specifically in implementation, but it works
val x = -y
println(5-<caret>x)
}
@@ -0,0 +1,4 @@
fun f() {
// this case is not processed specifically in implementation, but it works
println(5- -y)
}
@@ -0,0 +1,4 @@
fun foo() {
val f: (Int) -> Int = { x -> x }
val ff: (Int) -> Int = <caret>f
}
@@ -0,0 +1,3 @@
fun foo() {
val ff: (Int) -> Int = { x -> x }
}
@@ -0,0 +1,4 @@
fun foo() {
val f = { x -> x }
val ff = <caret>f
}
@@ -0,0 +1,3 @@
fun foo() {
val ff = { x -> x }
}
@@ -0,0 +1,4 @@
fun foo() {
val f: (Int) -> Int = { it }
val ff = <caret>f
}
@@ -0,0 +1,3 @@
fun foo() {
val ff = {(it: Int) -> it }
}
@@ -0,0 +1,6 @@
fun foo() {
val f: (Int) -> Int = {
it
}
val ff = <caret>f
}
@@ -0,0 +1,6 @@
fun foo() {
val ff = {
(it: Int) ->
it
}
}
@@ -0,0 +1,4 @@
fun foo() {
val f: (Int) -> Int = (({ x -> x }))
val ff = <caret>f
}
@@ -0,0 +1,3 @@
fun foo() {
val ff = (({(x: Int) -> x }))
}
@@ -0,0 +1,4 @@
fun foo() {
val f: (Int) -> Int = { x -> x }
val ff = <caret>f
}
@@ -0,0 +1,3 @@
fun foo() {
val ff = {(x: Int) -> x }
}
@@ -0,0 +1,4 @@
fun foo() {
val f = { 1 }
val ff = <caret>f
}
@@ -0,0 +1,3 @@
fun foo() {
val ff = { 1 }
}
@@ -0,0 +1,6 @@
import java.util.ArrayList
fun f() {
val v : List<Int> = ArrayList(listOf())
ArrayList(<caret>v)
}
@@ -0,0 +1,5 @@
import java.util.ArrayList
fun f() {
ArrayList(ArrayList<Int>(listOf()))
}
@@ -0,0 +1,6 @@
import java.util.ArrayList
fun f() {
val v : List<Int> = listOf()
val copy: List<Int> = ArrayList(<caret>v)
}
@@ -0,0 +1,5 @@
import java.util.ArrayList
fun f() {
val copy: List<Int> = ArrayList(listOf())
}
@@ -0,0 +1,7 @@
import java.util.ArrayList
fun f() {
val v : List<Int> = listOf()
val copy1: List<Int> = ArrayList(<caret>v)
val copy2: = ArrayList(v)
}
@@ -0,0 +1,6 @@
import java.util.ArrayList
fun f() {
val copy1: List<Int> = ArrayList(listOf())
val copy2: = ArrayList(listOf<Int>())
}
@@ -0,0 +1,4 @@
fun f() {
val v : List<Int> = listOf()
"$<caret>v"
}
@@ -0,0 +1,3 @@
fun f() {
"${listOf<Int>()}"
}

Some files were not shown because too many files have changed in this diff Show More