Fixed DFA for the last assignment / initialization in block. A relevant test. #KT-7599 Fixed.

This commit is contained in:
Mikhail Glukhikh
2015-04-27 19:30:02 +03:00
parent 60fdfb8441
commit 8f2a3e9d5f
4 changed files with 58 additions and 2 deletions
@@ -0,0 +1,23 @@
trait A {
fun ok(): Boolean
}
class B: A {
override fun ok(): Boolean { return true }
}
class C: A {
override fun ok(): Boolean { return false }
}
fun foo(): Boolean {
var v: A
v = B()
// No smart cast needed, but not a problem if ever
if (<!DEBUG_INFO_SMARTCAST!>v<!>.ok()) {
v = C()
}
// No smart cast needed, and no smart cast possible!
// We cannot choose between B and C
return v.ok()
}