diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index 3a821f1dc65d..40f9906038f6 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -478,7 +478,7 @@ class Namer { typer: Typer => if (child == other) annots // can happen if a class has several inaccessible children else { - assert(childStart != other.span.start, i"duplicate child annotation $child / $other") + assert(childStart != other.span.start || child.source != other.source, i"duplicate child annotation $child / $other") val (prefix, otherAnnot :: rest) = annots.span(_.symbol != defn.ChildAnnot): @unchecked prefix ::: otherAnnot :: insertInto(rest) }