diff --git a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileConstants.scala b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileConstants.scala index 02cebe2541ab..628c6ac1483c 100644 --- a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileConstants.scala +++ b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileConstants.scala @@ -341,7 +341,7 @@ object ClassfileConstants { case JAVA_ACC_PRIVATE => Private case JAVA_ACC_PROTECTED => Protected case JAVA_ACC_FINAL => Final - case JAVA_ACC_SYNTHETIC => Synthetic + case JAVA_ACC_SYNTHETIC => Synthetic | Artifact case JAVA_ACC_STATIC => JavaStatic case JAVA_ACC_ABSTRACT => if (isClass) Abstract else Deferred case JAVA_ACC_INTERFACE => PureInterfaceCreationFlags | JavaDefined diff --git a/compiler/src/dotty/tools/dotc/transform/Bridges.scala b/compiler/src/dotty/tools/dotc/transform/Bridges.scala index 884d5c71f2fd..0f1ca88d06d8 100644 --- a/compiler/src/dotty/tools/dotc/transform/Bridges.scala +++ b/compiler/src/dotty/tools/dotc/transform/Bridges.scala @@ -19,7 +19,7 @@ class Bridges(root: ClassSymbol, thisPhase: DenotTransformer)(implicit ctx: Cont private val preErasureCtx = ctx.withPhase(ctx.erasurePhase) private val elimErasedCtx = ctx.withPhase(ctx.elimErasedValueTypePhase.next) - private class BridgesCursor(implicit ctx: Context) extends OverridingPairs.Cursor(root) { + private class BridgesCursor(implicit ctx: Context) extends OverridingPairs.Cursor(root, excludeArtifacts = false) { /** Only use the superclass of `root` as a parent class. This means * overriding pairs that have a common implementation in a trait parent diff --git a/compiler/src/dotty/tools/dotc/transform/OverridingPairs.scala b/compiler/src/dotty/tools/dotc/transform/OverridingPairs.scala index bf7d9481d6d9..c6d69abd4aef 100644 --- a/compiler/src/dotty/tools/dotc/transform/OverridingPairs.scala +++ b/compiler/src/dotty/tools/dotc/transform/OverridingPairs.scala @@ -20,14 +20,15 @@ object OverridingPairs { /** The cursor class * @param base the base class that contains the overriding pairs */ - class Cursor(base: Symbol)(implicit ctx: Context) { + class Cursor(base: Symbol, excludeArtifacts: Boolean = true)(implicit ctx: Context) { private val self = base.thisType /** Symbols to exclude: Here these are constructors and private locals. * But it may be refined in subclasses. */ - protected def exclude(sym: Symbol): Boolean = !sym.memberCanMatchInheritedSymbols + protected def exclude(sym: Symbol): Boolean = + !sym.memberCanMatchInheritedSymbols || (excludeArtifacts && sym.is(Artifact)) /** The parents of base that are checked when deciding whether an overriding * pair has already been treated in a parent class. diff --git a/tests/pos/i6152/A_1.java b/tests/pos/i6152/A_1.java new file mode 100644 index 000000000000..8ca7ce38b25e --- /dev/null +++ b/tests/pos/i6152/A_1.java @@ -0,0 +1,8 @@ +abstract class A { + public abstract Object f(); + + public static abstract class B extends A { + @Override + public abstract String f(); + } +} diff --git a/tests/pos/i6152/Test_2.scala b/tests/pos/i6152/Test_2.scala new file mode 100644 index 000000000000..0e26a3741d61 --- /dev/null +++ b/tests/pos/i6152/Test_2.scala @@ -0,0 +1,8 @@ +class C extends A.B { + def f() = "hello" +} + +object Main extends App { + val c: A = new C + println(c.f()) +}