Skip to content

Commit 7accd88

Browse files
committed
Periods: reorder initializers.
Scalac inlines final val constants, making this code succeed. Dotty does not and by the type InitialPeriod was being initialised InitialRunId was not
1 parent eec8191 commit 7accd88

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,11 @@ object Periods {
136136

137137
final val Nowhere = new Period(0)
138138

139-
final val InitialPeriod = Period(InitialRunId, FirstPhaseId)
140139

141-
final val InvalidPeriod = Period(NoRunId, NoPhaseId)
140+
/** The number of bits needed to encode a phase identifier. */
141+
final val PhaseWidth = 6
142+
final val PhaseMask = (1 << PhaseWidth) - 1
143+
final val MaxPossiblePhaseId = PhaseMask
142144

143145
/** An ordinal number for compiler runs. First run has number 1. */
144146
type RunId = Int
@@ -152,8 +154,8 @@ object Periods {
152154
final val NoPhaseId = 0
153155
final val FirstPhaseId = 1
154156

155-
/** The number of bits needed to encode a phase identifier. */
156-
final val PhaseWidth = 6
157-
final val PhaseMask = (1 << PhaseWidth) - 1
158-
final val MaxPossiblePhaseId = PhaseMask
157+
158+
final val InitialPeriod = Period(InitialRunId, FirstPhaseId)
159+
160+
final val InvalidPeriod = Period(NoRunId, NoPhaseId)
159161
}

0 commit comments

Comments
 (0)