@@ -422,15 +422,15 @@ trait ImplicitRunInfo { self: Run =>
422
422
override implicit protected val ctx : Context = liftingCtx
423
423
override def stopAtStatic = true
424
424
def apply (tp : Type ) = tp match {
425
- case tp : TypeRef if tp.symbol.isAbstractOrAliasType =>
425
+ case tp : TypeRef if ! tp.symbol.canHaveCompanion =>
426
426
val pre = tp.prefix
427
427
def joinClass (tp : Type , cls : ClassSymbol ) =
428
428
AndType .make(tp, cls.typeRef.asSeenFrom(pre, cls.owner))
429
429
val lead = if (tp.prefix eq NoPrefix ) defn.AnyType else apply(tp.prefix)
430
430
(lead /: tp.classSymbols)(joinClass)
431
431
case tp : TypeVar =>
432
432
apply(tp.underlying)
433
- case tp : AppliedType if ! tp.tycon.typeSymbol.isClass =>
433
+ case tp : AppliedType if ! tp.tycon.typeSymbol.canHaveCompanion =>
434
434
def applyArg (arg : Type ) = arg match {
435
435
case TypeBounds (lo, hi) => AndType .make(lo, hi)
436
436
case WildcardType (TypeBounds (lo, hi)) => AndType .make(lo, hi)
@@ -468,21 +468,24 @@ trait ImplicitRunInfo { self: Run =>
468
468
case tp : NamedType =>
469
469
val pre = tp.prefix
470
470
comps ++= iscopeRefs(pre)
471
- def addClassScope (cls : ClassSymbol ): Unit = {
472
- def addRef (companion : TermRef ): Unit = {
473
- val compSym = companion.symbol
474
- if (compSym is Package )
475
- addRef(companion.select(nme.PACKAGE ))
476
- else if (compSym.exists)
477
- comps += companion.asSeenFrom(pre, compSym.owner).asInstanceOf [TermRef ]
478
- }
479
- def addParentScope (parent : Type ): Unit =
480
- iscopeRefs(tp.baseType(parent.classSymbol)) foreach addRef
481
- val companion = cls.companionModule
471
+ def addRef (companion : TermRef ): Unit = {
472
+ val compSym = companion.symbol
473
+ if (compSym is Package )
474
+ addRef(companion.select(nme.PACKAGE ))
475
+ else if (compSym.exists)
476
+ comps += companion.asSeenFrom(pre, compSym.owner).asInstanceOf [TermRef ]
477
+ }
478
+ def addCompanionOf (sym : Symbol ) = {
479
+ val companion = sym.companionModule
482
480
if (companion.exists) addRef(companion.termRef)
483
- cls.classParents foreach addParentScope
484
481
}
485
- tp.classSymbols(liftingCtx) foreach addClassScope
482
+ def addClassScope (cls : ClassSymbol ): Unit = {
483
+ addCompanionOf(cls)
484
+ for (parent <- cls.classParents; ref <- iscopeRefs(tp.baseType(parent.classSymbol)))
485
+ addRef(ref)
486
+ }
487
+ if (tp.widen.typeSymbol.isOpaqueAlias) addCompanionOf(tp.widen.typeSymbol)
488
+ else tp.classSymbols(liftingCtx).foreach(addClassScope)
486
489
case _ =>
487
490
for (part <- tp.namedPartsWith(_.isType)) comps ++= iscopeRefs(part)
488
491
}
0 commit comments