[JS IR] Add tests with reified generic and with KType on DCE to leave class
This commit is contained in:
committed by
TeamCityServer
parent
f0b3ee0e35
commit
507516e44d
Generated
+10
@@ -7116,6 +7116,11 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test {
|
||||
runTest("js/js.translator/testData/box/reflection/kClassOnReifiedTypeInLambda-advanced.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kClassReifiedWithJsCall.kt")
|
||||
public void testKClassReifiedWithJsCall() throws Exception {
|
||||
runTest("js/js.translator/testData/box/reflection/kClassReifiedWithJsCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kClassSimpleName.kt")
|
||||
public void testKClassSimpleName() throws Exception {
|
||||
runTest("js/js.translator/testData/box/reflection/kClassSimpleName.kt");
|
||||
@@ -7131,6 +7136,11 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test {
|
||||
runTest("js/js.translator/testData/box/reflection/kClassWithJsCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kTypeWithJsCall.kt")
|
||||
public void testKTypeWithJsCall() throws Exception {
|
||||
runTest("js/js.translator/testData/box/reflection/kTypeWithJsCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("primitiveKClassOnReifiedType.kt")
|
||||
public void testPrimitiveKClassOnReifiedType() throws Exception {
|
||||
runTest("js/js.translator/testData/box/reflection/primitiveKClassOnReifiedType.kt");
|
||||
|
||||
+10
@@ -7116,6 +7116,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/reflection/kClassOnReifiedTypeInLambda-advanced.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kClassReifiedWithJsCall.kt")
|
||||
public void testKClassReifiedWithJsCall() throws Exception {
|
||||
runTest("js/js.translator/testData/box/reflection/kClassReifiedWithJsCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kClassSimpleName.kt")
|
||||
public void testKClassSimpleName() throws Exception {
|
||||
runTest("js/js.translator/testData/box/reflection/kClassSimpleName.kt");
|
||||
@@ -7131,6 +7136,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/reflection/kClassWithJsCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kTypeWithJsCall.kt")
|
||||
public void testKTypeWithJsCall() throws Exception {
|
||||
runTest("js/js.translator/testData/box/reflection/kTypeWithJsCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("primitiveKClassOnReifiedType.kt")
|
||||
public void testPrimitiveKClassOnReifiedType() throws Exception {
|
||||
runTest("js/js.translator/testData/box/reflection/primitiveKClassOnReifiedType.kt");
|
||||
|
||||
+10
@@ -7141,6 +7141,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/reflection/kClassOnReifiedTypeInLambda-advanced.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kClassReifiedWithJsCall.kt")
|
||||
public void testKClassReifiedWithJsCall() throws Exception {
|
||||
runTest("js/js.translator/testData/box/reflection/kClassReifiedWithJsCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kClassSimpleName.kt")
|
||||
public void testKClassSimpleName() throws Exception {
|
||||
runTest("js/js.translator/testData/box/reflection/kClassSimpleName.kt");
|
||||
@@ -7156,6 +7161,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/reflection/kClassWithJsCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kTypeWithJsCall.kt")
|
||||
public void testKTypeWithJsCall() throws Exception {
|
||||
runTest("js/js.translator/testData/box/reflection/kTypeWithJsCall.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
|
||||
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KType
|
||||
import kotlin.reflect.typeOf
|
||||
|
||||
// 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(kType: KType) = (kType.classifier as KClass<*>)?.js
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
fun box(): String {
|
||||
return test(toJsClass(typeOf<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
|
||||
}
|
||||
Reference in New Issue
Block a user