[JS IR] Add test with class reference using from js
This commit is contained in:
committed by
TeamCityServer
parent
137532bfa6
commit
f0b3ee0e35
Generated
+5
@@ -7126,6 +7126,11 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test {
|
||||
runTest("js/js.translator/testData/box/reflection/kClassToAndFromJsClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kClassWithJsCall.kt")
|
||||
public void testKClassWithJsCall() throws Exception {
|
||||
runTest("js/js.translator/testData/box/reflection/kClassWithJsCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("primitiveKClassOnReifiedType.kt")
|
||||
public void testPrimitiveKClassOnReifiedType() throws Exception {
|
||||
runTest("js/js.translator/testData/box/reflection/primitiveKClassOnReifiedType.kt");
|
||||
|
||||
+5
@@ -7126,6 +7126,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/reflection/kClassToAndFromJsClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kClassWithJsCall.kt")
|
||||
public void testKClassWithJsCall() throws Exception {
|
||||
runTest("js/js.translator/testData/box/reflection/kClassWithJsCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("primitiveKClassOnReifiedType.kt")
|
||||
public void testPrimitiveKClassOnReifiedType() throws Exception {
|
||||
runTest("js/js.translator/testData/box/reflection/primitiveKClassOnReifiedType.kt");
|
||||
|
||||
+5
@@ -7151,6 +7151,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/reflection/kClassToAndFromJsClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kClassWithJsCall.kt")
|
||||
public void testKClassWithJsCall() throws Exception {
|
||||
runTest("js/js.translator/testData/box/reflection/kClassWithJsCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("primitiveKClassOnReifiedType.kt")
|
||||
public void testPrimitiveKClassOnReifiedType() throws Exception {
|
||||
runTest("js/js.translator/testData/box/reflection/primitiveKClassOnReifiedType.kt");
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
// MODULE: main
|
||||
// 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
|
||||
|
||||
fun toJsClass(klazz: KClass<B>) = klazz.js
|
||||
|
||||
fun box(): String {
|
||||
return test(toJsClass(B::class)).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
|
||||
}
|
||||
Reference in New Issue
Block a user