4cd4026174
Type-check "if (...) ;" to Unit, report "implicit cast to Unit", propagate data flow info out of its condition #KT-2478 Fixed
23 lines
404 B
Kotlin
23 lines
404 B
Kotlin
fun f1(s: String?) {
|
|
if (s!! == "");
|
|
s : String
|
|
}
|
|
|
|
fun f2(s: Number?) {
|
|
if (s is Int);
|
|
<!TYPE_MISMATCH!>s<!> : Int
|
|
if (s as Int == 42);
|
|
s : Int
|
|
}
|
|
|
|
fun f3(s: Number?) {
|
|
if (s is Int && s as Int == 42);
|
|
<!TYPE_MISMATCH!>s<!> : Int
|
|
}
|
|
|
|
fun f4(s: Int?) {
|
|
var u = <!IMPLICIT_CAST_TO_UNIT_OR_ANY!>if (s!! == 42)<!>;
|
|
if (u == Unit.VALUE) u = if (s == 239);
|
|
return u
|
|
}
|