From b875cc098f8e6a5210021e8d20e95966b264811b Mon Sep 17 00:00:00 2001 From: odersky Date: Sat, 9 Jul 2022 11:34:32 +0200 Subject: [PATCH] Avoid assertion failure for illegal trait inheritance Fixes #15629 --- compiler/src/dotty/tools/dotc/typer/Namer.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) }