Fix casts of Unit value to other types

This commit is contained in:
Alexander Udalov
2015-07-04 03:10:09 +03:00
parent 62c22bf0ec
commit cb03f0df5a
7 changed files with 52 additions and 15 deletions
-7
View File
@@ -1,7 +0,0 @@
fun println(s: String) {
}
fun box(): String {
println(":Hi!") as Any
return "OK"
}
+8
View File
@@ -0,0 +1,8 @@
fun println(s: String) {
}
fun box(): String {
val x = println(":Hi!") as Any
if (x != Unit) return "Fail: $x"
return "OK"
}
+8
View File
@@ -0,0 +1,8 @@
fun println(s: String) {
}
fun box(): String {
val x = println(":Hi!") as? Any
if (x != Unit) return "Fail: $x"
return "OK"
}