diff --git a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala index 3be0ac6fbbdf..6c0b63e3c1cd 100644 --- a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala +++ b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala @@ -101,9 +101,11 @@ class ExplicitOuter extends MiniPhase with InfoTransformer { thisPhase => val parents1 = for (parent <- impl.parents) yield val parentCls = parent.tpe.classSymbol.asClass - parent match // ensure class parent is a constructor + parent match + // if we are in a regular class and first parent is also a regular class, + // make sure we have a contructor case parent: TypeTree - if !parentCls.is(Trait) && !defn.NotRuntimeClasses.contains(parentCls) => + if !cls.is(Trait) && !parentCls.is(Trait) && !defn.NotRuntimeClasses.contains(parentCls) => New(parent.tpe, Nil).withSpan(impl.span) case _ => parent cpy.Template(impl)(parents = parents1, body = impl.body ++ newDefs) diff --git a/tests/pos/i9780.scala b/tests/pos/i9780.scala new file mode 100644 index 000000000000..f7670e05b845 --- /dev/null +++ b/tests/pos/i9780.scala @@ -0,0 +1,18 @@ +import java.awt.event.WindowEvent +import java.awt.{Window => AWTWindow} + +abstract class Window { + def peer: AWTWindow with InterfaceMixin + + protected trait InterfaceMixin extends javax.swing.RootPaneContainer + + protected trait SuperMixin extends java.awt.Window { + override protected def processWindowEvent(e: WindowEvent): Unit = { + super.processWindowEvent(e) + if (e.getID == WindowEvent.WINDOW_CLOSING) + closeOperation() + } + } + + def closeOperation(): Unit = () +}