Skip to content

Commit d9463d7

Browse files
oderskyDarkDimius
authored andcommitted
Fix phase of context for denotation transformer
The phase is now always the phase on which the denotation transformer is defined.
1 parent b5864b4 commit d9463d7

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ object Contexts {
280280
final def withMode(mode: Mode): Context =
281281
if (mode != this.mode) fresh.withNewMode(mode) else this
282282

283+
def withPhase(phase: PhaseId): Context =
284+
if (this.phaseId == phaseId) this else fresh.withPhase(phase)
285+
def withPhase(phase: Phase): Context =
286+
withPhase(phase.id)
287+
283288
final def addMode(mode: Mode): Context = withMode(this.mode | mode)
284289
final def maskMode(mode: Mode): Context = withMode(this.mode & mode)
285290
final def retractMode(mode: Mode): Context = withMode(this.mode &~ mode)
@@ -324,8 +329,7 @@ object Contexts {
324329

325330
def withProperty(prop: (String, Any)): this.type = withMoreProperties(moreProperties + prop)
326331

327-
def withPhase(pid: PhaseId): this.type = withPeriod(Period(runId, pid))
328-
def withPhase(phase: Phase): this.type = withPhase(phase.id)
332+
override def withPhase(pid: PhaseId): this.type = withPeriod(Period(runId, pid))
329333

330334
def withSetting[T](setting: Setting[T], value: T): this.type =
331335
withSettings(setting.updateIn(sstate, value))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ object Denotations {
524524
val transformer = ctx.denotTransformers(nextTranformerId)
525525
//println(s"transforming with $transformer")
526526
if (currentPeriod.lastPhaseId > transformer.id)
527-
next = transformer.transform(cur).syncWithParents
527+
next = transformer.transform(cur)(ctx.withPhase(startPid)).syncWithParents
528528
if (next eq cur)
529529
startPid = cur.validFor.firstPhaseId
530530
else {

0 commit comments

Comments
 (0)