Move variable declaration into when: don't report when property has 'break' or 'continue'

#KT-31999
This commit is contained in:
Toshiaki Kameyama
2019-09-24 09:29:00 +09:00
committed by Mikhail Glukhikh
parent 877e583a96
commit 998adfb098
4 changed files with 37 additions and 5 deletions
@@ -0,0 +1,12 @@
// PROBLEM: none
fun test() {
for (i in 1..10) {
val <caret>some = foo(i) ?: break
when (some) {
"some" -> some
else -> ""
}
}
}
fun foo(i: Int): String? = ""
@@ -0,0 +1,12 @@
// PROBLEM: none
fun test() {
for (i in 1..10) {
val <caret>some = foo(i) ?: continue
when (some) {
"some" -> some
else -> ""
}
}
}
fun foo(i: Int): String? = ""