Control-flow analysis: do-while scope is ended after condition but before jump #KT-15334 Fixed

This commit is contained in:
Mikhail Glukhikh
2017-01-09 18:49:17 +03:00
parent b7a5ff456f
commit b81268cca1
14 changed files with 208 additions and 25 deletions
@@ -0,0 +1,23 @@
// See KT-15334: incorrect reassignment in do...while
fun test() {
do {
val s: String
s = ""
} while (s == "")
}
fun test2() {
do {
val s: String
s = "1"
<!VAL_REASSIGNMENT!>s<!> = s + "2"
} while (s == "1")
}
fun test3() {
val s: String
do {
<!VAL_REASSIGNMENT!>s<!> = ""
} while (s != "")
}