Refactoring of JetTypeInfo / BindingContext. Loop data flow analysis corrected.

Now BindingContext includes expression type info instead of jump out possible, data flow info and expression type.
getType() was added into BindingContext, getType() and recordType() were added into BindingTrace.
JetTypeInfo now includes also jump possible flag and jump point data flow info.
Old TypeInfoWithJumpInfo deleted.
TypeInfoFactory introduced to create JetTypeInfo instances.
A pack of extra tests for break / continue in loops added.
This commit is contained in:
Mikhail Glukhikh
2015-04-20 16:12:49 +03:00
parent 14b92404cd
commit 27625b04e1
113 changed files with 908 additions and 550 deletions
@@ -0,0 +1,20 @@
fun bar(): Boolean { return true }
public fun foo(x: String?): Int {
var y: Int?
y = 0
@loop do {
<!DEBUG_INFO_SMARTCAST!>y<!> += when (x) {
null -> break@loop
"abc" -> return 0
"xyz" -> return 1
else -> <!DEBUG_INFO_SMARTCAST!>x<!>.length()
}
// y is always Int after when
<!DEBUG_INFO_SMARTCAST!>y<!>: Int
} while (bar())
// y is always Int even here
<!DEBUG_INFO_SMARTCAST!>y<!>: Int
// x is null because of the break
return x<!UNSAFE_CALL!>.<!>length()
}