Coerce any type to Number before unboxing

This commit is contained in:
Alexander Udalov
2012-10-26 18:03:40 +04:00
parent 627c3cf42e
commit 4cfe68da1e
3 changed files with 17 additions and 10 deletions
@@ -0,0 +1,5 @@
fun foo(x: Int) = x
fun bar(x: Comparable<Int>) = if (x is Int) foo(x) else 0
fun box() = if (bar(42) == 42) "OK" else "Fail"