Data flow information is no longer dropped while analyzing object literal expression. #KT-6293 Fixed. #KT-7110 Fixed.

A set of tests for KT-6293 / KT-7110 provided.
This commit is contained in:
Mikhail Glukhikh
2015-05-19 12:00:20 +03:00
parent 5bca1d3c8f
commit c8aa6defb6
19 changed files with 328 additions and 10 deletions
@@ -0,0 +1,19 @@
// See KT-6293: Smart cast doesn't work after object literal
abstract class Runnable {
abstract fun run()
}
fun foo(): Int {
val c: Int? = null
if (c is Int) {
var k: Runnable
val d: Int = <!DEBUG_INFO_SMARTCAST!>c<!>
k = object: Runnable() {
override fun run() = Unit
}
// Unnecessary but not important smart cast
<!DEBUG_INFO_SMARTCAST!>k<!>.run()
return <!DEBUG_INFO_SMARTCAST!>c<!> + d
}
else return -1
}