Replace is Array<T> with .isArrayOf<T>()

This commit is contained in:
Alexey Tsvetkov
2015-10-09 21:22:19 +03:00
parent 01cd277d63
commit 62c25c0370
19 changed files with 114 additions and 44 deletions
@@ -0,0 +1,2 @@
fun box() = if(arrayOfNulls<Int>(10).isArrayOf<java.lang.Integer>()) "OK" else "fail"
+1 -1
View File
@@ -1,5 +1,5 @@
fun foo(x : Any): String {
return if(x is Array<String>) x[0] else "fail"
return if(x is Array<*> && x.isArrayOf<String>()) (x as Array<String>)[0] else "fail"
}
fun box(): String {