diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 049ec5d4b5ea..49817e4e9ebc 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -1491,7 +1491,8 @@ class Typer extends Namer def typedParent(tree: untpd.Tree): Tree = { var result = if (tree.isType) typedType(tree)(superCtx) else typedExpr(tree)(superCtx) val psym = result.tpe.typeSymbol - if (seenParents.contains(psym)) ctx.error(i"$psym is extended twice", tree.pos) + if (seenParents.contains(psym) && !cls.isRefinementClass) + ctx.error(i"$psym is extended twice", tree.pos) seenParents += psym if (tree.isType) { if (psym.is(Trait) && !cls.is(Trait) && !cls.superClass.isSubClass(psym)) diff --git a/tests/pos/i4623.scala b/tests/pos/i4623.scala new file mode 100644 index 000000000000..31e673a13643 --- /dev/null +++ b/tests/pos/i4623.scala @@ -0,0 +1,7 @@ +trait Test { + type A <: Any { type T } + type B <: Any { type T } + type C <: A with B { type T } + + type D <: List[A] with List[B] { type T } +}