KT-20282 'Move statement up' works incorrectly for statement after 'finally' block if 'try' block contains closure

This commit is contained in:
Toshiaki Kameyama
2018-03-01 19:23:11 +09:00
committed by Nikolay Krasko
parent d3b1b7a5be
commit 9d6b36c249
16 changed files with 247 additions and 6 deletions
@@ -0,0 +1,10 @@
// MOVE: up
fun test() {
try {
run {
}
} catch (e: Exception) {
} catch (e: Throwable) {
}
<caret>println()
}
@@ -0,0 +1,10 @@
// MOVE: up
fun test() {
try {
run {
}
} catch (e: Exception) {
} catch (e: Throwable) {
<caret>println()
}
}
@@ -0,0 +1,9 @@
// MOVE: up
fun test(i: Int) {
if (i == 1) {
run {
}
} else {
}
<caret>println()
}
@@ -0,0 +1,9 @@
// MOVE: up
fun test(i: Int) {
if (i == 1) {
run {
}
} else {
<caret>println()
}
}
@@ -0,0 +1,11 @@
// MOVE: up
fun test(i: Int) {
if (i == 1) {
run {
}
} else if (i == 2) {
} else if (i == 3) {
} else {
}
<caret>println()
}
@@ -0,0 +1,11 @@
// MOVE: up
fun test(i: Int) {
if (i == 1) {
run {
}
} else if (i == 2) {
} else if (i == 3) {
} else {
<caret>println()
}
}
@@ -0,0 +1,10 @@
// MOVE: up
fun test(i: Int) {
if (i == 1) {
run {
}
} else if (i == 2) {
} else if (i == 3) {
}
<caret>println()
}
@@ -0,0 +1,10 @@
// MOVE: up
fun test(i: Int) {
if (i == 1) {
run {
}
} else if (i == 2) {
} else if (i == 3) {
<caret>println()
}
}
@@ -0,0 +1,11 @@
// MOVE: up
fun test() {
try {
run {
}
} catch (e: Exception) {
} catch (e: Throwable) {
} finally {
}
<caret>println()
}
@@ -0,0 +1,11 @@
// MOVE: up
fun test() {
try {
run {
}
} catch (e: Exception) {
} catch (e: Throwable) {
} finally {
<caret>println()
}
}
@@ -0,0 +1,14 @@
// MOVE: up
fun test(i: Int) {
when (i) {
1 -> {
run {
}
}
2 -> {
}
else -> {
}
}
<caret>println()
}
@@ -0,0 +1,14 @@
// MOVE: up
fun test(i: Int) {
when (i) {
1 -> {
run {
}
}
2 -> {
}
else -> {
<caret>println()
}
}
}
@@ -0,0 +1,14 @@
// MOVE: up
fun test(i: Int) {
when (i) {
1 -> {
run {
}
}
2 -> {
}
3 -> {
}
}
<caret>println()
}
@@ -0,0 +1,14 @@
// MOVE: up
fun test(i: Int) {
when (i) {
1 -> {
run {
}
}
2 -> {
}
3 -> {
<caret>println()
}
}
}