Fix elvis expression in case of nullable generic

This commit is contained in:
Alexander Udalov
2013-02-06 16:37:06 +04:00
parent 8697adb28a
commit 70f67c7993
4 changed files with 53 additions and 21 deletions
@@ -0,0 +1,8 @@
fun foo<T: Number?>(t: T) {
(t ?: 42).toInt()
}
fun box(): String {
foo<Int?>(null)
return "OK"
}
@@ -0,0 +1,6 @@
fun box(): String {
if ((42 ?: 239) != 42) return "Fail Int"
if ((42.toLong() ?: 239.toLong()) != 42.toLong()) return "Fail Long"
return "OK"
}