diff --git a/compiler/src/dotty/tools/dotc/Run.scala b/compiler/src/dotty/tools/dotc/Run.scala index acd885dd3afe..e9ec9dd3d96b 100644 --- a/compiler/src/dotty/tools/dotc/Run.scala +++ b/compiler/src/dotty/tools/dotc/Run.scala @@ -24,7 +24,6 @@ import scala.util.control.NonFatal /** A compiler run. Exports various methods to compile source files */ class Run(comp: Compiler)(implicit ctx: Context) { - assert(comp.phases.last.last.id <= Periods.MaxPossiblePhaseId) assert(ctx.runId <= Periods.MaxPossibleRunId) var units: List[CompilationUnit] = _ diff --git a/compiler/src/dotty/tools/dotc/core/Phases.scala b/compiler/src/dotty/tools/dotc/core/Phases.scala index 16f281a42ee9..409827f39ad6 100644 --- a/compiler/src/dotty/tools/dotc/core/Phases.scala +++ b/compiler/src/dotty/tools/dotc/core/Phases.scala @@ -348,6 +348,7 @@ object Phases { protected[Phases] def init(base: ContextBase, start: Int, end:Int): Unit = { if (start >= FirstPhaseId) assert(myPeriod == Periods.InvalidPeriod, s"phase $this has already been used once; cannot be reused") + assert(start <= Periods.MaxPossiblePhaseId, s"Too many phases, Period bits overflow") myBase = base myPeriod = Period(NoRunId, start, end) myErasedTypes = prev.getClass == classOf[Erasure] || prev.erasedTypes