File tree 3 files changed +15
-3
lines changed
compiler/src/dotty/tools/dotc/core 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -237,6 +237,7 @@ object Denotations {
237
237
final def validFor : Period = myValidFor
238
238
final def validFor_= (p : Period ): Unit =
239
239
myValidFor = p
240
+ symbol.setCheckedPeriod(Nowhere ): @ unchecked
240
241
241
242
/** Is this denotation different from NoDenotation or an ErrorDenotation? */
242
243
def exists : Boolean = true
Original file line number Diff line number Diff line change @@ -1810,6 +1810,7 @@ object SymDenotations {
1810
1810
1811
1811
/** The last denotation of this symbol */
1812
1812
var lastDenot : SymDenotation = _
1813
+ var checkedPeriod : Period = Nowhere
1813
1814
1814
1815
/** Overridden in NoSymbol */
1815
1816
// private[SymDenotations]
@@ -1819,11 +1820,13 @@ object SymDenotations {
1819
1820
override def hashCode = common.id // for debugging
1820
1821
1821
1822
/** The current denotation of this symbol */
1822
- def currentDenot (using Context ): SymDenotation =
1823
+ def computeDenot (using Context ): SymDenotation =
1823
1824
util.Stats .record(" Symbol.denot" )
1824
1825
val valid = validFor.code
1826
+ val now = ctx.period
1827
+ symbol.setCheckedPeriod(now)
1825
1828
// Next condition is inlined from Periods.containsSinglePhasePeriod
1826
- if ((valid - ctx.period .code) >>> PhaseWidth ) <= (valid & PhaseMask )
1829
+ if ((valid - now .code) >>> PhaseWidth ) <= (valid & PhaseMask )
1827
1830
then this
1828
1831
else recomputeDenot()
1829
1832
Original file line number Diff line number Diff line change @@ -113,15 +113,23 @@ object Symbols {
113
113
private [core] def denot_= (d : SymDenotation ): Unit =
114
114
util.Stats .record(" Symbol.denot_=" )
115
115
self.lastDenot = d
116
+ self.checkedPeriod = Nowhere
116
117
117
118
/** The current denotation of this symbol */
118
119
def denot (using Context ): SymDenotation =
119
- self.lastDenot.currentDenot
120
+ util.Stats .record(" Symbol.denot" )
121
+ val lastd = self.lastDenot
122
+ if self.checkedPeriod.code == ctx.period.code
123
+ then lastd
124
+ else lastd.computeDenot
120
125
121
126
private [core] def setLastDenot (d : SymDenotation ): SymDenotation =
122
127
self.lastDenot = d
123
128
d
124
129
130
+ def setCheckedPeriod (period : Period ): Unit =
131
+ self.checkedPeriod = period
132
+
125
133
/** The original denotation of this symbol, without forcing anything */
126
134
def originDenotation : SymDenotation = self
127
135
You can’t perform that action at this time.
0 commit comments