Move statement: do not move into lambda beyond 'if/when/try/for/while'

#KT-9065 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-08-03 17:29:09 +02:00
committed by Vladimir Dolzhenko
parent ee5ecb232a
commit 19824201e2
28 changed files with 296 additions and 0 deletions
@@ -0,0 +1,8 @@
// MOVE: down
fun test(i: Int) {
<caret>println()
do {
run {
}
} while (i == 1)
}
@@ -0,0 +1,8 @@
// MOVE: down
fun test(i: Int) {
do {
<caret>println()
run {
}
} while (i == 1)
}
@@ -0,0 +1,8 @@
// MOVE: up
fun test(i: Int) {
do {
run {
}
} while (i == 1)
<caret>println()
}
@@ -0,0 +1,8 @@
// MOVE: up
fun test(i: Int) {
do {
run {
}
<caret>println()
} while (i == 1)
}
@@ -0,0 +1,8 @@
// MOVE: down
fun test() {
<caret>println()
for (i in 1..10) {
run {
}
}
}
@@ -0,0 +1,8 @@
// MOVE: down
fun test() {
for (i in 1..10) {
<caret>println()
run {
}
}
}
@@ -0,0 +1,8 @@
// MOVE: up
fun test() {
for (i in 1..10) {
run {
}
}
<caret>println()
}
@@ -0,0 +1,8 @@
// MOVE: up
fun test() {
for (i in 1..10) {
run {
}
<caret>println()
}
}
@@ -0,0 +1,8 @@
// MOVE: down
fun test(i: Int) {
<caret>println()
if (i == 1) {
run {
}
}
}
@@ -0,0 +1,8 @@
// MOVE: down
fun test(i: Int) {
if (i == 1) {
<caret>println()
run {
}
}
}
@@ -0,0 +1,8 @@
// MOVE: up
fun test(i: Int) {
if (i == 1) {
run {
}
}
<caret>println()
}
@@ -0,0 +1,8 @@
// MOVE: up
fun test(i: Int) {
if (i == 1) {
run {
}
<caret>println()
}
}
@@ -0,0 +1,9 @@
// MOVE: down
fun test() {
<caret>println()
try {
run {
}
} finally {
}
}
@@ -0,0 +1,9 @@
// MOVE: down
fun test() {
try {
<caret>println()
run {
}
} finally {
}
}
@@ -0,0 +1,9 @@
// MOVE: up
fun test() {
try {
} finally {
run {
}
}
<caret>println()
}
@@ -0,0 +1,9 @@
// MOVE: up
fun test() {
try {
} finally {
run {
}
<caret>println()
}
}
@@ -0,0 +1,9 @@
// MOVE: up
fun test() {
try {
} catch (e: Exception) {
run {
}
}
<caret>println()
}
@@ -0,0 +1,9 @@
// MOVE: up
fun test() {
try {
} catch (e: Exception) {
run {
}
<caret>println()
}
}
@@ -0,0 +1,10 @@
// MOVE: down
fun test(i: Int) {
<caret>println()
when (i) {
1 -> {
run {
}
}
}
}
@@ -0,0 +1,10 @@
// MOVE: down
fun test(i: Int) {
when (i) {
1 -> {
<caret>println()
run {
}
}
}
}
@@ -0,0 +1,10 @@
// MOVE: up
fun test(i: Int) {
when (i) {
1 -> {
run {
}
}
}
<caret>println()
}
@@ -0,0 +1,10 @@
// MOVE: up
fun test(i: Int) {
when (i) {
1 -> {
run {
}
<caret>println()
}
}
}
@@ -0,0 +1,8 @@
// MOVE: down
fun test(i: Int) {
<caret>println()
while (i == 1) {
run {
}
}
}
@@ -0,0 +1,8 @@
// MOVE: down
fun test(i: Int) {
while (i == 1) {
<caret>println()
run {
}
}
}
@@ -0,0 +1,8 @@
// MOVE: up
fun test(i: Int) {
while (i == 1) {
run {
}
}
<caret>println()
}
@@ -0,0 +1,8 @@
// MOVE: up
fun test(i: Int) {
while (i == 1) {
run {
}
<caret>println()
}
}