Handle break / continue / throw in lift return / assignment intentions

So #KT-14900 Fixed
This commit is contained in:
Mikhail Glukhikh
2017-06-27 12:23:37 +03:00
committed by Mikhail Glukhikh
parent 523cbc6723
commit 8f33bd0768
6 changed files with 65 additions and 0 deletions
@@ -0,0 +1,13 @@
fun foo(): Int {
var res = 0
loop@ while (true) {
<caret>when (1) {
1 -> res += 1
2 -> throw Exception()
3 -> break@loop
4 -> continue@loop
else -> return -1
}
}
return res
}
@@ -0,0 +1,13 @@
fun foo(): Int {
var res = 0
loop@ while (true) {
res += when (1) {
1 -> 1
2 -> throw Exception()
3 -> break@loop
4 -> continue@loop
else -> return -1
}
}
return res
}
@@ -0,0 +1,12 @@
fun foo(): Int {
loop@ while (true) {
<caret>when (1) {
1 -> return 1
2 -> throw Exception()
3 -> break@loop
4 -> continue@loop
else -> return -1
}
}
return 0
}
@@ -0,0 +1,12 @@
fun foo(): Int {
loop@ while (true) {
return when (1) {
1 -> 1
2 -> throw Exception()
3 -> break@loop
4 -> continue@loop
else -> -1
}
}
return 0
}