[JS IR] Support external delegation in case of JS in psi2ir

- fix FE delegation resolver
 - fix critical KT-40650
This commit is contained in:
Roman Artemev
2020-07-28 14:18:57 +03:00
committed by romanart
parent c254651ed3
commit 0559e192ee
6 changed files with 53 additions and 3 deletions
@@ -1211,6 +1211,11 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test {
runTest("js/js.translator/testData/box/delegation/delegationByArg.kt");
}
@TestMetadata("delegationByCompanionToNothing.kt")
public void testDelegationByCompanionToNothing() throws Exception {
runTest("js/js.translator/testData/box/delegation/delegationByCompanionToNothing.kt");
}
@TestMetadata("delegationByExprWithArgs.kt")
public void testDelegationByExprWithArgs() throws Exception {
runTest("js/js.translator/testData/box/delegation/delegationByExprWithArgs.kt");
@@ -1211,6 +1211,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
runTest("js/js.translator/testData/box/delegation/delegationByArg.kt");
}
@TestMetadata("delegationByCompanionToNothing.kt")
public void testDelegationByCompanionToNothing() throws Exception {
runTest("js/js.translator/testData/box/delegation/delegationByCompanionToNothing.kt");
}
@TestMetadata("delegationByExprWithArgs.kt")
public void testDelegationByExprWithArgs() throws Exception {
runTest("js/js.translator/testData/box/delegation/delegationByExprWithArgs.kt");
@@ -1211,6 +1211,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
runTest("js/js.translator/testData/box/delegation/delegationByArg.kt");
}
@TestMetadata("delegationByCompanionToNothing.kt")
public void testDelegationByCompanionToNothing() throws Exception {
runTest("js/js.translator/testData/box/delegation/delegationByCompanionToNothing.kt");
}
@TestMetadata("delegationByExprWithArgs.kt")
public void testDelegationByExprWithArgs() throws Exception {
runTest("js/js.translator/testData/box/delegation/delegationByExprWithArgs.kt");
@@ -0,0 +1,22 @@
// EXPECTED_REACHABLE_NODES: 1253
// MODULE: lib
// FILE: lib.kt
interface II {
companion object : DDD by error("OK")
}
interface DDD {
fun bar(d: String = error("FAIL4")): String
}
// MODULE: main(lib)
// FILE: main.kt
fun box() : String {
try {
return II.bar()
} catch (e: IllegalStateException) {
return e.message ?: "FAIL 2"
}
return "FAIL"
}
@@ -1,6 +1,9 @@
// EXPECTED_REACHABLE_NODES: 1236
// KJS_WITH_FULL_RUNTIME
// KT-40126
// MODULE: lib
// FILE: l.kt
@file:Suppress("EXTERNAL_DELEGATION")
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
@@ -12,4 +15,9 @@ external interface MySymbolConstructor {
operator fun invoke(description: String = definedExternally): Any
}
fun box() = "OK"
// MODULE: main(lib)
// FILE: f.kt
fun foo(ee: MySymbol?) = "OK"
fun box() = foo(null)