JS: support reified usage in extension functions

This commit is contained in:
Alexey Tsvetkov
2015-05-06 17:23:21 +03:00
parent 79ab47d374
commit 818b197169
4 changed files with 41 additions and 17 deletions
@@ -0,0 +1,17 @@
package foo
// CHECK_NOT_CALLED: canBeCastedTo
open class A
class B
class C : A()
inline fun Any.canBeCastedTo<reified T>(): Boolean = this is T
fun box(): String {
assertEquals(true, A().canBeCastedTo<A>(), "A().canBeCastedTo<A>()")
assertEquals(false, A().canBeCastedTo<B>(), "A().canBeCastedTo<B>()")
assertEquals(true, C().canBeCastedTo<A>(), "C().canBeCastedTo<A>()")
return "OK"
}