[JS IR BE] Fix overriding property of Throwable
This commit is contained in:
+5
@@ -2697,6 +2697,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/expression/try/nestedTryCatchInCatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overrideThrowableProperties.kt")
|
||||
public void testOverrideThrowableProperties() throws Exception {
|
||||
runTest("js/js.translator/testData/box/expression/try/overrideThrowableProperties.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("rethrowExceptionIfNotCaught.kt")
|
||||
public void testRethrowExceptionIfNotCaught() throws Exception {
|
||||
runTest("js/js.translator/testData/box/expression/try/rethrowExceptionIfNotCaught.kt");
|
||||
|
||||
+5
@@ -2712,6 +2712,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/expression/try/nestedTryCatchInCatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("overrideThrowableProperties.kt")
|
||||
public void testOverrideThrowableProperties() throws Exception {
|
||||
runTest("js/js.translator/testData/box/expression/try/overrideThrowableProperties.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("rethrowExceptionIfNotCaught.kt")
|
||||
public void testRethrowExceptionIfNotCaught() throws Exception {
|
||||
runTest("js/js.translator/testData/box/expression/try/rethrowExceptionIfNotCaught.kt");
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1315
|
||||
|
||||
open class Ex0(msg: String, cs: Throwable): Throwable(msg, cs)
|
||||
|
||||
class Ex1: Ex0("A", Error("fail2")) {
|
||||
override val cause = Error("B")
|
||||
}
|
||||
|
||||
class Ex2: Ex0("fail3", Error("C")) {
|
||||
override val message = "D"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val ex1: Throwable = Ex1()
|
||||
val ex2: Throwable = Ex2()
|
||||
|
||||
val r = ex1.message + ex1.cause?.message + ex2.cause?.message + ex2.message
|
||||
if (r != "ABCD") return "Fail: $r"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user