Files
kotlin-fork/js/js.translator/testData/box/reflection/kClassReifiedWithJsCall.kt
T
Ilya Goncharov 74d1812461 [JS IR] Review remarks
- Move origin to common place
- Add comments and todo about solution
- Remove MODULE directive from tests
- Add test with in-place using of js function
2021-05-17 16:51:22 +03:00

40 lines
544 B
Kotlin
Vendored

import kotlin.reflect.KClass
// FILE: main.kt
external abstract open class A(
o: String
) {
abstract val k: String
fun test(): String
}
class B(
o: String
) : A(o) {
override val k = "K"
}
external fun test(
klazz: Any
) : B
inline fun <reified T : Any> toJsClass() = T::class.js
fun box(): String {
return test(toJsClass<B>()).test()
}
// FILE: test.js
function test(classType) {
return new classType("O")
}
function A(o) {
this.o = o
}
A.prototype.test = function() {
return this.o + this.k
}