Data flow info: correct disjunction of a type with Nothing: Type U Nothing = Type #KT-9578 Fixed

This commit is contained in:
Mikhail Glukhikh
2016-01-18 14:59:24 +03:00
parent 5d3186ac49
commit 9360bd49a6
6 changed files with 61 additions and 3 deletions
+15
View File
@@ -0,0 +1,15 @@
fun foo(s: Any): String {
val x = when (s) {
is String -> s
is Int -> "$s"
else -> return ""
}
val y: String = x
return y
}
fun box() = if (foo("OK") == "OK" && foo(42) == "42" && foo(true) == "") "OK" else "Fail"