FIR DFA: make continue jump to condition entry, not loop entry

It's also not a backwards jump in do-while, unless it's in the loop's
condition, which is a stupid "feature" IMO. As you can probably tell
from the comments added in this commit.
This commit is contained in:
pyos
2022-11-14 15:27:08 +01:00
committed by teamcity
parent 7e407585fc
commit f9745bd3f1
9 changed files with 26 additions and 42 deletions
@@ -1,13 +0,0 @@
fun x(): Boolean { return true }
fun y(): Boolean { return false }
public fun foo(p: String?): Int {
do {
if (y()) continue
// We do not always reach this statement
p!!.length
} while (!x())
// Here we have do while loop but p is still nullable due to continue before
return p.length
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
fun x(): Boolean { return true }
fun y(): Boolean { return false }
@@ -5,10 +5,10 @@ public fun foo(p: String?, r: String?): Int {
do {
p!!.length
if (!x()) continue@outer
} while (r == null)
} while (r == null)
} while (!x())
// Auto cast NOT possible due to long continue
r.length
r<!UNSAFE_CALL!>.<!>length
// Auto cast possible
return p.length
}
@@ -5,7 +5,7 @@ public fun foo(p: String?, r: String?): Int {
do {
p!!.length
if (!x()) continue@outer
} while (r == null)
} while (r == null)
} while (!x())
// Auto cast NOT possible due to long continue
r<!UNSAFE_CALL!>.<!>length