JS: chained reified function calls (KT-12527) fixed

This commit is contained in:
Anton Bannykh
2016-11-17 19:41:01 +03:00
parent a57748f4f4
commit 2f0bccfb09
5 changed files with 57 additions and 1 deletions
+36
View File
@@ -0,0 +1,36 @@
inline fun <reified T> Any?.check(): Boolean {
return this is T
}
inline fun <reified T> Any?.check2(): Boolean {
return check<T>()
}
var log = ""
fun log(a: Any?) {
log += a.toString() + ";"
}
fun test(a: Any?) {
log(a.check<String>())
log(a.check<String?>())
}
fun test2(a: Any?) {
log(a.check2<String>())
log(a.check2<String?>())
}
fun box(): String {
test("")
test(null)
test2("")
test2(null)
if (log != "true;true;false;true;true;true;false;true;") {
return "fail"
}
return "OK"
}