diff --git a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala index 86b15800f548..9acc3ef34319 100644 --- a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala +++ b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala @@ -97,15 +97,13 @@ class ExplicitOuter extends MiniPhase with InfoTransformer { thisPhase => } val parents1 = - for (parent <- impl.parents) yield { + for (parent <- impl.parents) yield val parentCls = parent.tpe.classSymbol.asClass - if (parentCls.is(Trait)) - parent - else parent match { // ensure class parent is a constructor - case parent: TypeTree => New(parent.tpe, Nil).withSpan(impl.span) + parent match // ensure class parent is a constructor + case parent: TypeTree + if !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) } else impl diff --git a/tests/pos/i7809.scala b/tests/pos/i7809.scala new file mode 100644 index 000000000000..69e27c180e66 --- /dev/null +++ b/tests/pos/i7809.scala @@ -0,0 +1,5 @@ +class A { + trait B extends Any { + println() + } +} \ No newline at end of file