@@ -1877,19 +1877,21 @@ object SymDenotations {
18771877 super .info_=(tp)
18781878 }
18791879
1880- /** The symbols of the parent classes. */
1881- def parentSyms (using Context ): List [Symbol ] = info match {
1882- case classInfo : ClassInfo => classInfo.declaredParents.map(_.classSymbol)
1880+ /** The types of the parent classes. */
1881+ def parentTypes (using Context ): List [Type ] = info match
1882+ case classInfo : ClassInfo => classInfo.declaredParents
18831883 case _ => Nil
1884- }
1884+
1885+ /** The symbols of the parent classes. */
1886+ def parentSyms (using Context ): List [Symbol ] =
1887+ parentTypes.map(_.classSymbol)
18851888
18861889 /** The symbol of the superclass, NoSymbol if no superclass exists */
1887- def superClass (using Context ): Symbol = parentSyms match {
1888- case parent :: _ =>
1889- if (parent.is(Trait )) NoSymbol else parent
1890- case _ =>
1891- NoSymbol
1892- }
1890+ def superClass (using Context ): Symbol = parentTypes match
1891+ case parentType :: _ =>
1892+ val parentCls = parentType.classSymbol
1893+ if parentCls.is(Trait ) then NoSymbol else parentCls
1894+ case _ => NoSymbol
18931895
18941896 /** The explicitly given self type (self types of modules are assumed to be
18951897 * explcitly given here).
@@ -1951,20 +1953,20 @@ object SymDenotations {
19511953 def computeBaseData (implicit onBehalf : BaseData , ctx : Context ): (List [ClassSymbol ], BaseClassSet ) = {
19521954 def emptyParentsExpected =
19531955 is(Package ) || (symbol == defn.AnyClass ) || ctx.erasedTypes && (symbol == defn.ObjectClass )
1954- val psyms = parentSyms
1955- if (psyms .isEmpty && ! emptyParentsExpected)
1956+ val parents = parentTypes
1957+ if (parents .isEmpty && ! emptyParentsExpected)
19561958 onBehalf.signalProvisional()
19571959 val builder = new BaseDataBuilder
1958- def traverse (parents : List [Symbol ]): Unit = parents match {
1960+ def traverse (parents : List [Type ]): Unit = parents match {
19591961 case p :: parents1 =>
1960- p match {
1962+ p.classSymbol match {
19611963 case pcls : ClassSymbol => builder.addAll(pcls.baseClasses)
19621964 case _ => assert(isRefinementClass || p.isError || ctx.mode.is(Mode .Interactive ), s " $this has non-class parent: $p" )
19631965 }
19641966 traverse(parents1)
19651967 case nil =>
19661968 }
1967- traverse(psyms )
1969+ traverse(parents )
19681970 (classSymbol :: builder.baseClasses, builder.baseClassSet)
19691971 }
19701972
@@ -2313,9 +2315,11 @@ object SymDenotations {
23132315 var names = Set [Name ]()
23142316 def maybeAdd (name : Name ) = if (keepOnly(thisType, name)) names += name
23152317 try {
2316- for (p <- parentSyms if p.isClass)
2317- for (name <- p.asClass.memberNames(keepOnly))
2318- maybeAdd(name)
2318+ for ptype <- parentTypes do
2319+ ptype.classSymbol match
2320+ case pcls : ClassSymbol =>
2321+ for name <- pcls.memberNames(keepOnly) do
2322+ maybeAdd(name)
23192323 val ownSyms =
23202324 if (keepOnly eq implicitFilter)
23212325 if (this .is(Package )) Iterator .empty
0 commit comments