diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala index c593fa17333d..f83d011175d5 100644 --- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala @@ -1779,16 +1779,22 @@ object SymDenotations { def computeMemberNames(keepOnly: NameFilter)(implicit onBehalf: MemberNames, ctx: Context): Set[Name] = { var names = Set[Name]() def maybeAdd(name: Name) = if (keepOnly(thisType, name)) names += name - for (p <- classParents) - for (name <- p.classSymbol.asClass.memberNames(keepOnly)) - maybeAdd(name) - val ownSyms = - if (keepOnly eq implicitFilter) - if (this is Package) Iterator.empty - else info.decls.iterator filter (_ is Implicit) - else info.decls.iterator - for (sym <- ownSyms) maybeAdd(sym.name) - names + try { + for (p <- classParents) + for (name <- p.classSymbol.asClass.memberNames(keepOnly)) + maybeAdd(name) + val ownSyms = + if (keepOnly eq implicitFilter) + if (this is Package) Iterator.empty + else info.decls.iterator filter (_ is Implicit) + else info.decls.iterator + for (sym <- ownSyms) maybeAdd(sym.name) + names + } + catch { + case ex: Throwable => + handleRecursive("member names", i"of $this", ex) + } } override final def fullNameSeparated(kind: QualifiedNameKind)(implicit ctx: Context): Name = { diff --git a/tests/neg/i5332.scala b/tests/neg/i5332.scala new file mode 100644 index 000000000000..51d682125656 --- /dev/null +++ b/tests/neg/i5332.scala @@ -0,0 +1,5 @@ + +object O{ + type T[R] = X + class X extends T[Int] // error +} \ No newline at end of file