Fix too aggressive data-flow clearing of loop-assigned vars

This is effectively a revert of
447c127036, which was an (incorrect) fix
for KT-22379.

The bug was that we've cleared data-flow info for assigned variables
*after* knowledge that loop condition if 'false' was applied (we can
claim that if loop has no jump-outs). Therefore, we broke smartcasts in
the innocent code like that:

  var x: Int? = null
  while (x == null) {
      x = readPotentiallyNullableInt()
  }
  // x should be non-null here

Commit reverts that "fix" for 1.3.0 and postpones deprecation until 1.4

KT-22379 Open
KT-27084 Fixed
This commit is contained in:
Dmitry Savvinov
2018-09-24 18:50:00 +03:00
parent 99454aa78d
commit 6065095e24
3 changed files with 5 additions and 16 deletions
@@ -5,5 +5,5 @@ fun main(args: Array<String>) {
if (i == 10) result = "non null"
else i++
}
result<!UNSAFE_CALL!>.<!>length
<!DEBUG_INFO_SMARTCAST!>result<!>.length
}