Skip to content

Commit 900e5c4

Browse files
committed
Fist compiler run id is now InitialRunId instead of InitialRunId + 1
This is an attempt at fixing stale symbol errors
1 parent 0f0618b commit 900e5c4

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

compiler/src/dotty/tools/dotc/Compiler.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,11 @@ class Compiler {
122122
List(new GenBCode) :: // Generate JVM bytecode
123123
Nil
124124

125-
var runId: Int = 1
126-
def nextRunId: Int = {
127-
runId += 1; runId
125+
private[this] var runId: Int = Periods.InitialRunId
126+
def nextRunId(): Int = {
127+
val next = runId
128+
runId += 1
129+
next
128130
}
129131

130132
def reset()(implicit ctx: Context): Unit = {

compiler/src/dotty/tools/dotc/Run.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
4444
ctx.base.setPhasePlan(comp.phases)
4545
val rootScope = new MutableScope
4646
val bootstrap = ctx.fresh
47-
.setPeriod(Period(comp.nextRunId, FirstPhaseId))
47+
.setPeriod(Period(comp.nextRunId(), FirstPhaseId))
4848
.setScope(rootScope)
4949
rootScope.enter(ctx.definitions.RootPackage)(bootstrap)
5050
val start = bootstrap.fresh
@@ -169,7 +169,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
169169
Stats.trackTime(s"$phase ms ") {
170170
val start = System.currentTimeMillis
171171
val profileBefore = profiler.beforePhase(phase)
172-
units = phase.runOn(units)(ctx.fresh.setPhase(phase.start))
172+
units = phase.runOn(units)(ctx.withPhase(phase))
173173
profiler.afterPhase(phase, profileBefore)
174174
if (ctx.settings.Xprint.value.containsPhase(phase)) {
175175
for (unit <- units) {

0 commit comments

Comments
 (0)