Few fixes to Introduce Variable (no new features added)

Added few tests to Introduce Variable
More strict requirements for expressions to introduce it.
This commit is contained in:
Alefas
2012-02-08 17:07:38 +04:00
parent 7bbc121f72
commit 6fe52d15b4
17 changed files with 317 additions and 21 deletions
@@ -0,0 +1,13 @@
fun a() {
1
1
if (true) <selection>1</selection>
}
/*
fun a() {
val i = 1
i
i
if (true) i
}
*/
@@ -0,0 +1,16 @@
fun a(op: (Int) -> Int) {}
fun b() {
a {it}
a {
<selection>it</selection>
}
}
/*
fun a(op: (Int) -> Int) {}
fun b() {
a {it}
a {
val i = it
}
}
*/
@@ -0,0 +1,9 @@
fun a() {
for (a in <selection>1..2</selection>) {}
}
/*
fun a() {
val intRange = 1..2
for (a in intRange) {}
}
*/
@@ -0,0 +1,25 @@
fun a() {
if (true) {
if (true) {
1
}
} else {
if (true) {
<selection>1</selection>
}
}
}
/*
fun a() {
val i = 1
if (true) {
if (true) {
i
}
} else {
if (true) {
i
}
}
}
*/
@@ -0,0 +1,33 @@
fun a() {
if (true) {
<selection>1</selection>
}
if (true) {
1
}
if (true) {
1
} else {
if (true) {
1
}
}
}
/*
fun a() {
val i = 1
if (true) {
i
}
if (true) {
i
}
if (true) {
i
} else {
if (true) {
i
}
}
}
*/
@@ -0,0 +1,11 @@
fun a(x: Int) {}
fun b() {
a(<selection>1</selection>)
}
/*
fun a(x: Int) {}
fun b() {
val i = 1
a(i)
}
*/
@@ -0,0 +1,8 @@
fun a() {
<selection>1</selection>
}
/*
fun a() {
val i = 1
}
*/
@@ -0,0 +1,9 @@
fun a() {
"it's a number ${<selection>1</selection>}"
}
/*
fun a() {
val i = 1
"it's a number ${i}"
}
*/
@@ -0,0 +1,15 @@
fun a() {
when (1) {
is 3 -> 1
is 4 -> <selection>1</selection>
}
}
/*
fun a() {
val i = 1
when (i) {
is 3 -> i
is 4 -> i
}
}
*/
@@ -0,0 +1,9 @@
fun a() {
while (<selection>true</selection>) {}
}
/*
fun a() {
val b = true
while (b) {}
}
*/