Handle break / continue / throw in lift return / assignment intentions
So #KT-14900 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
523cbc6723
commit
8f33bd0768
@@ -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
|
||||
}
|
||||
+13
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user