Skip to content

Commit 7c5dd00

Browse files
committed
Merge pull request #89 from dotty-staging/fix/transform-contexts
Fix phase of context for denotation transformer
2 parents 83449e1 + d9463d7 commit 7c5dd00

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

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

Lines changed: 7 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,8 @@ 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))
333+
override def withPhase(phase: Phase): this.type = withPhase(phase.id)
329334

330335
def withSetting[T](setting: Setting[T], value: T): this.type =
331336
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)