Skip to content

Commit 670f602

Browse files
committed
Change phase handling in enteredAfter
This makes it more consistent with related methods ensureFreshScopeAfter, installAfter.
1 parent b140f85 commit 670f602

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/dotty/tools/dotc/core/Symbols.scala

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -396,15 +396,16 @@ object Symbols {
396396
* that starts being valid after `phase`.
397397
* @pre Symbol is a class member
398398
*/
399-
def enteredAfter(phase: DenotTransformer)(implicit ctx: Context): this.type = {
400-
val nextCtx = ctx.withPhase(phase.next)
401-
if (this.owner.is(Package)) {
402-
denot.validFor |= InitialPeriod
403-
if (this is Module) this.moduleClass.validFor |= InitialPeriod
399+
def enteredAfter(phase: DenotTransformer)(implicit ctx: Context): this.type =
400+
if (ctx.phaseId != phase.next.id) enteredAfter(phase)(ctx.withPhase(phase.next))
401+
else {
402+
if (this.owner.is(Package)) {
403+
denot.validFor |= InitialPeriod
404+
if (this is Module) this.moduleClass.validFor |= InitialPeriod
405+
}
406+
else this.owner.asClass.ensureFreshScopeAfter(phase)
407+
entered
404408
}
405-
else this.owner.asClass.ensureFreshScopeAfter(phase)(nextCtx)
406-
entered(nextCtx)
407-
}
408409

409410
/** This symbol, if it exists, otherwise the result of evaluating `that` */
410411
def orElse(that: => Symbol)(implicit ctx: Context) =

0 commit comments

Comments
 (0)