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