Extra test with smart cast to 'T'

This commit is contained in:
Mikhail Glukhikh
2016-01-20 16:42:58 +03:00
parent d5ffa0bbca
commit 7ac55cefcb
5 changed files with 43 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
class Wrapper<T>(var x: T)
inline fun <reified T> change(w: Wrapper<T>, x: Any?) {
if (x is T) {
w.x = x
}
}
fun box(): String {
val w = Wrapper<String>("FAIL")
change(w, "OK")
return w.x
}