Skip to content

Commit f886d62

Browse files
committed
Use effectiveScope when creating companionLinks
This was accidentally reverted from b641181.
1 parent b1d899f commit f886d62

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

compiler/src/dotty/tools/dotc/transform/ResolveSuper.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import util.Positions._
1919
import Names._
2020
import collection.mutable
2121
import ResolveSuper._
22-
import config.Config
2322

2423
/** This phase adds super accessors and method overrides where
2524
* linearization differs from Java's rule for default methods in interfaces.
@@ -96,7 +95,7 @@ object ResolveSuper {
9695
def rebindSuper(base: Symbol, acc: Symbol)(implicit ctx: Context): Symbol = {
9796
var bcs = base.info.baseClasses.dropWhile(acc.owner != _).tail
9897
var sym: Symbol = NoSymbol
99-
val SuperAccessorName(memberName) = acc.name.unexpandedName // dotty deviation: ": Name" needed otherwise pattern type is neither a subtype nor a supertype of selector type
98+
val SuperAccessorName(memberName) = acc.name.unexpandedName
10099
ctx.debuglog(i"starting rebindsuper from $base of ${acc.showLocated}: ${acc.info} in $bcs, name = $memberName")
101100
while (bcs.nonEmpty && sym == NoSymbol) {
102101
val other = bcs.head.info.nonPrivateDecl(memberName)

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,8 @@ class Namer { typer: Typer =>
570570

571571
/** Create links between companion object and companion class */
572572
def createLinks(classTree: TypeDef, moduleTree: TypeDef)(implicit ctx: Context) = {
573-
val claz = ctx.denotNamed(classTree.name).symbol
574-
val modl = ctx.denotNamed(moduleTree.name).symbol
573+
val claz = ctx.effectiveScope.lookup(classTree.name)
574+
val modl = ctx.effectiveScope.lookup(moduleTree.name)
575575
ctx.synthesizeCompanionMethod(nme.COMPANION_CLASS_METHOD, claz, modl).entered
576576
ctx.synthesizeCompanionMethod(nme.COMPANION_MODULE_METHOD, modl, claz).entered
577577
}

0 commit comments

Comments
 (0)