diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ClassReferenceLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ClassReferenceLowering.kt index cffb4d09c6b..9f547ca5c50 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ClassReferenceLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ClassReferenceLowering.kt @@ -42,7 +42,6 @@ class ClassReferenceLowering(val context: JsIrBackendContext) : FileLoweringPass IrType::isDouble to "doubleClass", IrType::isArray to "arrayClass", IrType::isString to "stringClass", - IrType::isThrowable to "throwableClass", IrType::isBooleanArray to "booleanArrayClass", IrType::isCharArray to "charArrayClass", IrType::isByteArray to "byteArrayClass", @@ -60,6 +59,7 @@ class ClassReferenceLowering(val context: JsIrBackendContext) : FileLoweringPass mapOf( IrType::isAny to "anyClass", IrType::isNumber to "numberClass", + IrType::isThrowable to "throwableClass", IrType::isNothing to "nothingClass" ).mapValues { primitiveClassProperty(it.value) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java index 5e382b6c0ca..f8e94df0641 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrBoxJsTestGenerated.java @@ -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); } + @TestMetadata("classJsName.kt") + public void testClassJsName() throws Exception { + runTest("js/js.translator/testData/box/reflection/classJsName.kt"); + } + @TestMetadata("external.kt") public void testExternal() throws Exception { runTest("js/js.translator/testData/box/reflection/external.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java index 179b994721a..0469307eacc 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BoxJsTestGenerated.java @@ -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); } + @TestMetadata("classJsName.kt") + public void testClassJsName() throws Exception { + runTest("js/js.translator/testData/box/reflection/classJsName.kt"); + } + @TestMetadata("external.kt") public void testExternal() throws Exception { runTest("js/js.translator/testData/box/reflection/external.kt"); diff --git a/js/js.translator/testData/box/reflection/classJsName.kt b/js/js.translator/testData/box/reflection/classJsName.kt new file mode 100644 index 00000000000..47a490fa32c --- /dev/null +++ b/js/js.translator/testData/box/reflection/classJsName.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() +} \ No newline at end of file