Fix unjustified descriptorToDeclaration in bridge codegen
Delegated and synthesized members don't usually have a declaration as well as fake overrides
This commit is contained in:
@@ -66,6 +66,7 @@ import static org.jetbrains.jet.codegen.AsmUtil.*;
|
|||||||
import static org.jetbrains.jet.codegen.JvmSerializationBindings.*;
|
import static org.jetbrains.jet.codegen.JvmSerializationBindings.*;
|
||||||
import static org.jetbrains.jet.codegen.binding.CodegenBinding.asmTypeForAnonymousClass;
|
import static org.jetbrains.jet.codegen.binding.CodegenBinding.asmTypeForAnonymousClass;
|
||||||
import static org.jetbrains.jet.codegen.binding.CodegenBinding.isLocalNamedFun;
|
import static org.jetbrains.jet.codegen.binding.CodegenBinding.isLocalNamedFun;
|
||||||
|
import static org.jetbrains.jet.lang.descriptors.CallableMemberDescriptor.Kind.DECLARATION;
|
||||||
import static org.jetbrains.jet.lang.resolve.BindingContextUtils.callableDescriptorToDeclaration;
|
import static org.jetbrains.jet.lang.resolve.BindingContextUtils.callableDescriptorToDeclaration;
|
||||||
import static org.jetbrains.jet.lang.resolve.BindingContextUtils.descriptorToDeclaration;
|
import static org.jetbrains.jet.lang.resolve.BindingContextUtils.descriptorToDeclaration;
|
||||||
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isFunctionLiteral;
|
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isFunctionLiteral;
|
||||||
@@ -440,9 +441,7 @@ public class FunctionCodegen extends ParentCodegenAwareImpl {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!bridgesToGenerate.isEmpty()) {
|
if (!bridgesToGenerate.isEmpty()) {
|
||||||
PsiElement origin = descriptor.getKind().isReal()
|
PsiElement origin = descriptor.getKind() == DECLARATION ? callableDescriptorToDeclaration(bindingContext, descriptor) : null;
|
||||||
? callableDescriptorToDeclaration(bindingContext, descriptor)
|
|
||||||
: null;
|
|
||||||
for (Bridge<Method> bridge : bridgesToGenerate) {
|
for (Bridge<Method> bridge : bridgesToGenerate) {
|
||||||
generateBridge(origin, bridge.getFrom(), bridge.getTo());
|
generateBridge(origin, bridge.getFrom(), bridge.getTo());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class delegationAndInheritanceFromJava {
|
||||||
|
public interface A extends Set<String> {}
|
||||||
|
|
||||||
|
public interface B extends Set<String> {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import delegationAndInheritanceFromJava.*
|
||||||
|
import java.util.HashSet
|
||||||
|
|
||||||
|
class Impl(b: B): A, B by b
|
||||||
|
|
||||||
|
fun box() = "OK"
|
||||||
+15
-1
@@ -31,7 +31,7 @@ import org.jetbrains.jet.codegen.generated.AbstractBlackBoxCodegenTest;
|
|||||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||||
@SuppressWarnings("all")
|
@SuppressWarnings("all")
|
||||||
@TestMetadata("compiler/testData/codegen/boxWithJava")
|
@TestMetadata("compiler/testData/codegen/boxWithJava")
|
||||||
@InnerTestClasses({BlackBoxWithJavaCodegenTestGenerated.Annotations.class, BlackBoxWithJavaCodegenTestGenerated.CallableReference.class, BlackBoxWithJavaCodegenTestGenerated.Constructor.class, BlackBoxWithJavaCodegenTestGenerated.Enum.class, BlackBoxWithJavaCodegenTestGenerated.Functions.class, BlackBoxWithJavaCodegenTestGenerated.InnerClass.class, BlackBoxWithJavaCodegenTestGenerated.Property.class, BlackBoxWithJavaCodegenTestGenerated.Sam.class, BlackBoxWithJavaCodegenTestGenerated.StaticFun.class, BlackBoxWithJavaCodegenTestGenerated.Visibility.class})
|
@InnerTestClasses({BlackBoxWithJavaCodegenTestGenerated.Annotations.class, BlackBoxWithJavaCodegenTestGenerated.CallableReference.class, BlackBoxWithJavaCodegenTestGenerated.Constructor.class, BlackBoxWithJavaCodegenTestGenerated.Delegation.class, BlackBoxWithJavaCodegenTestGenerated.Enum.class, BlackBoxWithJavaCodegenTestGenerated.Functions.class, BlackBoxWithJavaCodegenTestGenerated.InnerClass.class, BlackBoxWithJavaCodegenTestGenerated.Property.class, BlackBoxWithJavaCodegenTestGenerated.Sam.class, BlackBoxWithJavaCodegenTestGenerated.StaticFun.class, BlackBoxWithJavaCodegenTestGenerated.Visibility.class})
|
||||||
public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||||
public void testAllFilesPresentInBoxWithJava() throws Exception {
|
public void testAllFilesPresentInBoxWithJava() throws Exception {
|
||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxWithJava"), Pattern.compile("^(.+)\\.kt$"), true);
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxWithJava"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
@@ -101,6 +101,19 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("compiler/testData/codegen/boxWithJava/delegation")
|
||||||
|
public static class Delegation extends AbstractBlackBoxCodegenTest {
|
||||||
|
public void testAllFilesPresentInDelegation() throws Exception {
|
||||||
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxWithJava/delegation"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("delegationAndInheritanceFromJava.kt")
|
||||||
|
public void testDelegationAndInheritanceFromJava() throws Exception {
|
||||||
|
doTestWithJava("compiler/testData/codegen/boxWithJava/delegation/delegationAndInheritanceFromJava.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/boxWithJava/enum")
|
@TestMetadata("compiler/testData/codegen/boxWithJava/enum")
|
||||||
public static class Enum extends AbstractBlackBoxCodegenTest {
|
public static class Enum extends AbstractBlackBoxCodegenTest {
|
||||||
public void testAllFilesPresentInEnum() throws Exception {
|
public void testAllFilesPresentInEnum() throws Exception {
|
||||||
@@ -566,6 +579,7 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege
|
|||||||
suite.addTestSuite(Annotations.class);
|
suite.addTestSuite(Annotations.class);
|
||||||
suite.addTestSuite(CallableReference.class);
|
suite.addTestSuite(CallableReference.class);
|
||||||
suite.addTestSuite(Constructor.class);
|
suite.addTestSuite(Constructor.class);
|
||||||
|
suite.addTestSuite(Delegation.class);
|
||||||
suite.addTestSuite(Enum.class);
|
suite.addTestSuite(Enum.class);
|
||||||
suite.addTestSuite(Functions.class);
|
suite.addTestSuite(Functions.class);
|
||||||
suite.addTestSuite(InnerClass.class);
|
suite.addTestSuite(InnerClass.class);
|
||||||
|
|||||||
Reference in New Issue
Block a user