Support bridges in interfaces. Fix for KT-12416: Missed bridges in js backend
#KT-12416 Fixed
This commit is contained in:
@@ -125,6 +125,12 @@ public class BridgeTestGenerated extends AbstractBridgeTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt12416.kt")
|
||||
public void testKt12416() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/kt12416.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt1939.kt")
|
||||
public void testKt1939() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/kt1939.kt");
|
||||
@@ -287,6 +293,12 @@ public class BridgeTestGenerated extends AbstractBridgeTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("twoParentsWithDifferentMethodsTwoBridges2.kt")
|
||||
public void testTwoParentsWithDifferentMethodsTwoBridges2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/twoParentsWithDifferentMethodsTwoBridges2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("twoParentsWithTheSameMethodOneBridge.kt")
|
||||
public void testTwoParentsWithTheSameMethodOneBridge() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/twoParentsWithTheSameMethodOneBridge.kt");
|
||||
|
||||
+7
-2
@@ -77,6 +77,8 @@ class ClassTranslator private constructor(
|
||||
|
||||
private fun isTrait(): Boolean = descriptor.kind == ClassKind.INTERFACE
|
||||
|
||||
private fun isAnnotation(): Boolean = descriptor.kind == ClassKind.ANNOTATION_CLASS
|
||||
|
||||
private fun generateClassCreateInvocationArguments() {
|
||||
val properties = SmartList<JsPropertyInitializer>()
|
||||
val staticProperties = SmartList<JsPropertyInitializer>()
|
||||
@@ -369,7 +371,7 @@ class ClassTranslator private constructor(
|
||||
}
|
||||
|
||||
private fun generatedBridgeMethods(properties: MutableList<JsPropertyInitializer>) {
|
||||
if (isTrait()) return
|
||||
if (isAnnotation()) return
|
||||
|
||||
generateBridgesToTraitImpl(properties)
|
||||
|
||||
@@ -387,7 +389,10 @@ class ClassTranslator private constructor(
|
||||
private fun generateOtherBridges(properties: MutableList<JsPropertyInitializer>) {
|
||||
for (memberDescriptor in descriptor.defaultType.memberScope.getContributedDescriptors()) {
|
||||
if (memberDescriptor is FunctionDescriptor) {
|
||||
val bridgesToGenerate = generateBridgesForFunctionDescriptor(memberDescriptor, identity())
|
||||
val bridgesToGenerate = generateBridgesForFunctionDescriptor(memberDescriptor, identity()) {
|
||||
//There is no DefaultImpls in js backend so if method non-abstract it should be recognized as non-abstract on bridges calculation
|
||||
false
|
||||
}
|
||||
|
||||
for (bridge in bridgesToGenerate) {
|
||||
generateBridge(bridge, properties)
|
||||
|
||||
Reference in New Issue
Block a user