Files
kotlin-fork/js/js.translator/testData/box/jsName/methodOfInterface.kt
T
Alexander Korepanov caa1570e25 [JS IR] Fix clashes between bridge and delegated function call
The patch fixes the js function signature rules to avoid clashes
 between bridge and delegated call. Use overridden symbols dfs of
 JsName annotation in order to get the correct bridge name.

^KT-52968 Fixed
2022-07-28 14:41:47 +00:00

38 lines
1.2 KiB
Kotlin
Vendored

interface TestInterface {
@JsName("testName")
fun testFunction(): String
fun testFunction(x: String): String
}
interface TestInterfaceA : TestInterface {
override fun testFunction(): String
override fun testFunction(x: String): String
}
class TestClassA : TestInterfaceA {
override fun testFunction(): String = "TestClassA"
override fun testFunction(x: String): String = "TestClassA: $x"
}
fun testTestInterface1(x: TestInterface) = x.testFunction()
fun testTestInterface2(x: TestInterface) = x.testFunction("OK")
fun testTestInterfaceA1(x: TestInterfaceA) = x.testFunction()
fun testTestInterfaceA2(x: TestInterfaceA) = x.testFunction("OK")
fun testTestClassA1(x: TestClassA) = x.testFunction()
fun testTestClassA2(x: TestClassA) = x.testFunction("OK")
fun box(): String {
assertEquals("TestClassA", testTestInterface1(TestClassA()))
assertEquals("TestClassA: OK", testTestInterface2(TestClassA()))
assertEquals("TestClassA", testTestInterfaceA1(TestClassA()))
assertEquals("TestClassA: OK", testTestInterfaceA2(TestClassA()))
assertEquals("TestClassA", testTestClassA1(TestClassA()))
assertEquals("TestClassA: OK", testTestClassA2(TestClassA()))
return "OK"
}