@@ -520,27 +520,32 @@ trait ImplicitRunInfo { self: Run =>
520520 val comps = new TermRefSet
521521 tp match {
522522 case tp : NamedType =>
523- val pre = tp.prefix
524- comps ++= iscopeRefs(pre)
525- def addRef (companion : TermRef ): Unit = {
526- val compSym = companion.symbol
527- if (compSym is Package )
528- addRef(companion.select(nme.PACKAGE ))
529- else if (compSym.exists)
530- comps += companion.asSeenFrom(pre, compSym.owner).asInstanceOf [TermRef ]
531- }
532- def addCompanionOf (sym : Symbol ) = {
533- val companion = sym.companionModule
534- if (companion.exists) addRef(companion.termRef)
535- }
536- def addClassScope (cls : ClassSymbol ): Unit = {
537- addCompanionOf(cls)
538- for (parent <- cls.classParents; ref <- iscopeRefs(tp.baseType(parent.classSymbol)))
539- addRef(ref)
523+ if (! tp.symbol.is(Package ) || ctx.scala2Mode) {
524+ // Don't consider implicits in package prefixes unless under -language:Scala2
525+ val pre = tp.prefix
526+ comps ++= iscopeRefs(pre)
527+ def addRef (companion : TermRef ): Unit = {
528+ val compSym = companion.symbol
529+ if (compSym is Package ) {
530+ assert(ctx.scala2Mode)
531+ addRef(companion.select(nme.PACKAGE ))
532+ }
533+ else if (compSym.exists)
534+ comps += companion.asSeenFrom(pre, compSym.owner).asInstanceOf [TermRef ]
535+ }
536+ def addCompanionOf (sym : Symbol ) = {
537+ val companion = sym.companionModule
538+ if (companion.exists) addRef(companion.termRef)
539+ }
540+ def addClassScope (cls : ClassSymbol ): Unit = {
541+ addCompanionOf(cls)
542+ for (parent <- cls.classParents; ref <- iscopeRefs(tp.baseType(parent.classSymbol)))
543+ addRef(ref)
544+ }
545+ val underlyingTypeSym = tp.widen.typeSymbol
546+ if (underlyingTypeSym.isOpaqueAlias) addCompanionOf(underlyingTypeSym)
547+ else tp.classSymbols(liftingCtx).foreach(addClassScope)
540548 }
541- val underlyingTypeSym = tp.widen.typeSymbol
542- if (underlyingTypeSym.isOpaqueAlias) addCompanionOf(underlyingTypeSym)
543- else tp.classSymbols(liftingCtx).foreach(addClassScope)
544549 case _ =>
545550 for (part <- tp.namedPartsWith(_.isType)) comps ++= iscopeRefs(part)
546551 }
0 commit comments