@@ -901,28 +901,25 @@ class Namer { typer: Typer =>
901
901
def registerIfChild (denot : SymDenotation )(implicit ctx : Context ): Unit = {
902
902
val sym = denot.symbol
903
903
904
- def register (child : Symbol , parent : Type ) = {
905
- val cls = parent.classSymbol
906
- if (cls.is(Sealed ))
907
- if ((child.isInaccessibleChildOf(cls) || child.isAnonymousClass) && ! sym.hasAnonymousChild)
908
- addChild(cls, cls)
909
- else if (! cls.is(ChildrenQueried ))
910
- addChild(cls, child)
904
+ def register (child : Symbol , parentCls : ClassSymbol ) = {
905
+ if (parentCls.is(Sealed ))
906
+ if ((child.isInaccessibleChildOf(parentCls) || child.isAnonymousClass) && ! sym.hasAnonymousChild)
907
+ addChild(parentCls, parentCls)
908
+ else if (! parentCls.is(ChildrenQueried ))
909
+ addChild(parentCls, child)
911
910
else
912
- ctx.error(em """ children of $cls were already queried before $sym was discovered.
913
- |As a remedy, you could move $sym on the same nesting level as $cls . """ ,
911
+ ctx.error(em """ children of $parentCls were already queried before $sym was discovered.
912
+ |As a remedy, you could move $sym on the same nesting level as $parentCls . """ ,
914
913
child.sourcePos)
915
914
}
916
915
917
- if (denot.isClass && ! sym.isEnumAnonymClass && ! sym.isRefinementClass)
918
- denot.asClass.classParents.foreach { parent =>
919
- val child = if (denot.is(Module )) denot.sourceModule else denot.symbol
920
- register(child, parent)
921
- }
922
- else if (denot.is(CaseVal , butNot = Method | Module )) {
916
+ if denot.isClass && ! sym.isEnumAnonymClass && ! sym.isRefinementClass then
917
+ val child = if (denot.is(Module )) denot.sourceModule else denot.symbol
918
+ denot.asClass.classParents.foreach { parent => register(child, parent.classSymbol.asClass) }
919
+ else if denot.is(CaseVal , butNot = Method | Module ) then
923
920
assert(denot.is(Enum ), denot)
924
- register(denot.symbol, denot.info)
925
- }
921
+ denot.info.classSymbols.foreach { parent => register(denot.symbol, parent) }
922
+ end if
926
923
}
927
924
928
925
/** Intentionally left without `implicit ctx` parameter. We need
0 commit comments