Skip to content

Commit 10167c4

Browse files
committed
Check period validity once per run.
1 parent 5027f01 commit 10167c4

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/dotty/tools/dotc/Run.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import scala.reflect.io.VirtualFile
1313

1414
class Run(comp: Compiler)(implicit ctx: Context) {
1515

16+
assert(comp.phases.last.last.id <= Periods.MaxPossiblePhaseId)
17+
assert(ctx.runId <= Periods.MaxPossibleRunId)
18+
1619
var units: List[CompilationUnit] = _
1720

1821
def getSource(fileName: String): SourceFile = {

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,16 @@ object Periods {
120120

121121
/** The single-phase period consisting of given run id and phase id */
122122
def apply(rid: RunId, pid: PhaseId): Period = {
123-
assert(rid <= MaxPossibleRunId)
124-
assert(pid <= MaxPossiblePhaseId)
125123
new Period(((rid << PhaseWidth) | pid) << PhaseWidth)
126124
}
127125

128126
/** The period consisting of given run id, and lo/hi phase ids */
129127
def apply(rid: RunId, loPid: PhaseId, hiPid: PhaseId): Period = {
130-
assert(rid <= MaxPossibleRunId)
131-
assert(loPid <= MaxPossiblePhaseId)
132-
assert(hiPid <= MaxPossiblePhaseId)
133-
134128
new Period(((rid << PhaseWidth) | hiPid) << PhaseWidth | (hiPid - loPid))
135129
}
136130

137131
/** The interval consisting of all periods of given run id */
138132
def allInRun(rid: RunId) = {
139-
assert(rid <= MaxPossibleRunId)
140133
apply(rid, 0, PhaseMask)
141134
}
142135
}

0 commit comments

Comments
 (0)