Commit Graph

3 Commits

Author SHA1 Message Date
Mikhail Glukhikh f3555daa60 Report UNUSED_PARAMETER on main parameter in 1.3+ #KT-26999 Fixed 2018-10-25 19:10:39 +03:00
Dmitry Savvinov 6065095e24 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
2018-09-27 12:09:22 +03:00
Dmitry Savvinov 99454aa78d Add test on smartcast from while-assigned var
Currently behavior is undesired, it will be fixed in the next commit
(see KT-27084)
2018-09-27 12:09:21 +03:00