[JS IR] Fix IrGetClass for Throwable successors
- add test
This commit is contained in:
+1
-1
@@ -42,7 +42,6 @@ class ClassReferenceLowering(val context: JsIrBackendContext) : FileLoweringPass
|
|||||||
IrType::isDouble to "doubleClass",
|
IrType::isDouble to "doubleClass",
|
||||||
IrType::isArray to "arrayClass",
|
IrType::isArray to "arrayClass",
|
||||||
IrType::isString to "stringClass",
|
IrType::isString to "stringClass",
|
||||||
IrType::isThrowable to "throwableClass",
|
|
||||||
IrType::isBooleanArray to "booleanArrayClass",
|
IrType::isBooleanArray to "booleanArrayClass",
|
||||||
IrType::isCharArray to "charArrayClass",
|
IrType::isCharArray to "charArrayClass",
|
||||||
IrType::isByteArray to "byteArrayClass",
|
IrType::isByteArray to "byteArrayClass",
|
||||||
@@ -60,6 +59,7 @@ class ClassReferenceLowering(val context: JsIrBackendContext) : FileLoweringPass
|
|||||||
mapOf(
|
mapOf(
|
||||||
IrType::isAny to "anyClass",
|
IrType::isAny to "anyClass",
|
||||||
IrType::isNumber to "numberClass",
|
IrType::isNumber to "numberClass",
|
||||||
|
IrType::isThrowable to "throwableClass",
|
||||||
IrType::isNothing to "nothingClass"
|
IrType::isNothing to "nothingClass"
|
||||||
).mapValues {
|
).mapValues {
|
||||||
primitiveClassProperty(it.value)
|
primitiveClassProperty(it.value)
|
||||||
|
|||||||
+5
@@ -6698,6 +6698,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/reflection"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/reflection"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("classJsName.kt")
|
||||||
|
public void testClassJsName() throws Exception {
|
||||||
|
runTest("js/js.translator/testData/box/reflection/classJsName.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("external.kt")
|
@TestMetadata("external.kt")
|
||||||
public void testExternal() throws Exception {
|
public void testExternal() throws Exception {
|
||||||
runTest("js/js.translator/testData/box/reflection/external.kt");
|
runTest("js/js.translator/testData/box/reflection/external.kt");
|
||||||
|
|||||||
+5
@@ -6728,6 +6728,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/reflection"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/reflection"), Pattern.compile("^([^_](.+))\\.kt$"), TargetBackend.JS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("classJsName.kt")
|
||||||
|
public void testClassJsName() throws Exception {
|
||||||
|
runTest("js/js.translator/testData/box/reflection/classJsName.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("external.kt")
|
@TestMetadata("external.kt")
|
||||||
public void testExternal() throws Exception {
|
public void testExternal() throws Exception {
|
||||||
runTest("js/js.translator/testData/box/reflection/external.kt");
|
runTest("js/js.translator/testData/box/reflection/external.kt");
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
// EXPECTED_REACHABLE_NODES: 1282
|
||||||
|
|
||||||
|
|
||||||
|
fun Throwable.className() = this::class.simpleName!!
|
||||||
|
|
||||||
|
class O : Error()
|
||||||
|
class K : Error()
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val o = O()
|
||||||
|
val k = K()
|
||||||
|
return o.className() + k.className()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user