[JS IR BE] Fix Throwable ancestor transformation

Make sure that `message` and `cause` are properly configured

 - synchronize IR BE and Legacy behaviour
 - fix corresponding IR lowering
 - fix JS IR core runtime
 - add test
 - fix KT-39964
This commit is contained in:
Roman Artemev
2020-10-06 16:06:57 +03:00
parent 383146f836
commit ff093d363a
6 changed files with 46 additions and 6 deletions
@@ -7675,6 +7675,11 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test {
public void testStringPlus() throws Exception {
runTest("js/js.translator/testData/box/standardClasses/stringPlus.kt");
}
@TestMetadata("throwableCtor.kt")
public void testThrowableCtor() throws Exception {
runTest("js/js.translator/testData/box/standardClasses/throwableCtor.kt");
}
}
@TestMetadata("js/js.translator/testData/box/superCall")
@@ -7675,6 +7675,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
public void testStringPlus() throws Exception {
runTest("js/js.translator/testData/box/standardClasses/stringPlus.kt");
}
@TestMetadata("throwableCtor.kt")
public void testThrowableCtor() throws Exception {
runTest("js/js.translator/testData/box/standardClasses/throwableCtor.kt");
}
}
@TestMetadata("js/js.translator/testData/box/superCall")
@@ -7705,6 +7705,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
public void testStringPlus() throws Exception {
runTest("js/js.translator/testData/box/standardClasses/stringPlus.kt");
}
@TestMetadata("throwableCtor.kt")
public void testThrowableCtor() throws Exception {
runTest("js/js.translator/testData/box/standardClasses/throwableCtor.kt");
}
}
@TestMetadata("js/js.translator/testData/box/superCall")
@@ -0,0 +1,10 @@
// EXPECTED_REACHABLE_NODES: 1237
// KT-39964
fun box(): String {
val e = Throwable(null, IllegalStateException("fail"))
if (e.message != null) return "FAIL"
return "OK"
}