@@ -194,9 +194,6 @@ object Denotations {
194
194
*/
195
195
def infoOrCompleter : Type
196
196
197
- /** The period during which this denotation is valid. */
198
- def validFor : Period
199
-
200
197
/** Is this a reference to a type symbol? */
201
198
def isType : Boolean
202
199
@@ -229,6 +226,15 @@ object Denotations {
229
226
*/
230
227
def current (using Context ): Denotation
231
228
229
+ /** The period during which this denotation is valid. */
230
+ private var myValidFor : Period = Nowhere
231
+
232
+ final def validFor : Period = myValidFor
233
+ final def validFor_= (p : Period ): Unit = {
234
+ myValidFor = p
235
+ symbol.invalidateDenotCache()
236
+ }
237
+
232
238
/** Is this denotation different from NoDenotation or an ErrorDenotation? */
233
239
def exists : Boolean = true
234
240
@@ -664,14 +670,6 @@ object Denotations {
664
670
665
671
// ------ Transformations -----------------------------------------
666
672
667
- private var myValidFor : Period = Nowhere
668
-
669
- def validFor : Period = myValidFor
670
- def validFor_= (p : Period ): Unit = {
671
- myValidFor = p
672
- symbol.invalidateDenotCache()
673
- }
674
-
675
673
/** The next SingleDenotation in this run, with wrap-around from last to first.
676
674
*
677
675
* There may be several `SingleDenotation`s with different validity
@@ -695,7 +693,7 @@ object Denotations {
695
693
if (validFor.firstPhaseId <= 1 ) this
696
694
else {
697
695
var current = nextInRun
698
- while (current.validFor.code > this .myValidFor .code) current = current.nextInRun
696
+ while (current.validFor.code > this .validFor .code) current = current.nextInRun
699
697
current
700
698
}
701
699
@@ -776,7 +774,7 @@ object Denotations {
776
774
* are otherwise undefined.
777
775
*/
778
776
def skipRemoved (using Context ): SingleDenotation =
779
- if (myValidFor .code <= 0 ) nextDefined else this
777
+ if (validFor .code <= 0 ) nextDefined else this
780
778
781
779
/** Produce a denotation that is valid for the given context.
782
780
* Usually called when !(validFor contains ctx.period)
@@ -793,7 +791,7 @@ object Denotations {
793
791
def current (using Context ): SingleDenotation =
794
792
util.Stats .record(" current" )
795
793
val currentPeriod = ctx.period
796
- val valid = myValidFor
794
+ val valid = validFor
797
795
798
796
def assertNotPackage (d : SingleDenotation , transformer : DenotTransformer ) = d match
799
797
case d : ClassDenotation =>
@@ -963,7 +961,7 @@ object Denotations {
963
961
case denot : SymDenotation => s " in ${denot.owner}"
964
962
case _ => " "
965
963
}
966
- s " stale symbol; $this# ${symbol.id} $ownerMsg, defined in ${myValidFor }, is referred to in run ${ctx.period}"
964
+ s " stale symbol; $this# ${symbol.id} $ownerMsg, defined in ${validFor }, is referred to in run ${ctx.period}"
967
965
}
968
966
969
967
/** The period (interval of phases) for which there exists
@@ -1248,8 +1246,9 @@ object Denotations {
1248
1246
/** An overloaded denotation consisting of the alternatives of both given denotations.
1249
1247
*/
1250
1248
case class MultiDenotation (denot1 : Denotation , denot2 : Denotation ) extends Denotation (NoSymbol , NoType ) with MultiPreDenotation {
1249
+ validFor = denot1.validFor & denot2.validFor
1250
+
1251
1251
final def infoOrCompleter : Type = multiHasNot(" info" )
1252
- final def validFor : Period = denot1.validFor & denot2.validFor
1253
1252
final def isType : Boolean = false
1254
1253
final def hasUniqueSym : Boolean = false
1255
1254
final def name (using Context ): Name = denot1.name
0 commit comments