@@ -41,15 +41,19 @@ trait SymDenotations { this: Context =>
4141
4242 def stillValid (denot : SymDenotation ): Boolean =
4343 if (denot is ValidForever ) true
44- else try {
45- val owner = denot.owner.denot
46- stillValid(owner) && (
47- ! owner.isClass
48- || (owner.unforcedDecls.lookupAll(denot.name) contains denot.symbol)
49- || denot.isSelfSym
50- )
51- } catch {
52- case ex : StaleSymbol => false
44+ else {
45+ val initial = denot.initial
46+ if (initial ne denot)
47+ ctx.withPhase(initial.validFor.firstPhaseId).stillValid(initial.asSymDenotation)
48+ else try {
49+ val owner = denot.owner.denot
50+ stillValid(owner) && (
51+ ! owner.isClass
52+ || (owner.unforcedDecls.lookupAll(denot.name) contains denot.symbol)
53+ || denot.isSelfSym)
54+ } catch {
55+ case ex : StaleSymbol => false
56+ }
5357 }
5458}
5559
@@ -70,6 +74,12 @@ object SymDenotations {
7074
7175 override def hasUniqueSym : Boolean = exists
7276
77+ /** Debug only
78+ override def validFor_=(p: Period) = {
79+ super.validFor_=(p)
80+ }
81+ */
82+
7383 // ------ Getting and setting fields -----------------------------
7484
7585 private [this ] var myFlags : FlagSet = adaptFlags(initFlags)
@@ -171,13 +181,13 @@ object SymDenotations {
171181 myInfo = tp
172182 }
173183
174- /** The name, except
175- * - if this is a module class, strip the module class suffix
176- * - if this is a companion object with a clash-avoiding name, strip the
184+ /** The name, except
185+ * - if this is a module class, strip the module class suffix
186+ * - if this is a companion object with a clash-avoiding name, strip the
177187 * "avoid clash" suffix
178188 */
179189 def effectiveName (implicit ctx : Context ) =
180- if (this is ModuleClass ) name.stripModuleClassSuffix
190+ if (this is ModuleClass ) name.stripModuleClassSuffix
181191 else name.stripAvoidClashSuffix
182192
183193 /** The privateWithin boundary, NoSymbol if no boundary is given.
@@ -195,7 +205,7 @@ object SymDenotations {
195205
196206 /** Update the annotations of this denotation */
197207 private [core] final def annotations_= (annots : List [Annotation ]): Unit =
198- myAnnotations = annots
208+ myAnnotations = annots
199209
200210 /** Does this denotation have an annotation matching the given class symbol? */
201211 final def hasAnnotation (cls : Symbol )(implicit ctx : Context ) =
@@ -241,9 +251,9 @@ object SymDenotations {
241251 /** The symbols defined in this class or object.
242252 * Careful! This does not force the type, so is compilation order dependent.
243253 * This method should be used only in the following circumstances:
244- *
245- * 1. When accessing type parameters or type parameter accessors (both are entered before
246- * completion).
254+ *
255+ * 1. When accessing type parameters or type parameter accessors (both are entered before
256+ * completion).
247257 * 2. When obtaining the current scope in order to enter, rename or delete something there.
248258 * 3. When playing it safe in order not to raise CylicReferences, e.g. for printing things
249259 * or taking more efficient shortcuts (e.g. the stillValid test).
@@ -292,7 +302,6 @@ object SymDenotations {
292302 if (isType) fn.toTypeName else fn.toTermName
293303 }
294304
295-
296305 /** The encoded flat name of this denotation, where joined names are separated by `separator` characters. */
297306 def flatName (separator : Char = '$' )(implicit ctx : Context ): Name =
298307 if (symbol == NoSymbol || owner == NoSymbol || owner.isEffectiveRoot || (owner is PackageClass )) name
@@ -457,7 +466,7 @@ object SymDenotations {
457466 }
458467
459468 /** Is this a user defined "def" method? Excluded are accessors and anonymous functions. */
460- final def isSourceMethod (implicit ctx : Context ) =
469+ final def isSourceMethod (implicit ctx : Context ) =
461470 this .is(Method , butNot = AccessorOrLabel ) && ! isAnonymousFunction
462471
463472 /** Is this a setter? */
@@ -649,7 +658,7 @@ object SymDenotations {
649658 */
650659 /** The class implementing this module, NoSymbol if not applicable. */
651660 final def moduleClass (implicit ctx : Context ): Symbol = {
652- def notFound = {println(s " missing module class for $name: $myInfo" ); NoSymbol }
661+ def notFound = { println(s " missing module class for $name: $myInfo" ); NoSymbol }
653662 if (this is ModuleVal )
654663 myInfo match {
655664 case info : TypeRef => info.symbol
@@ -1002,7 +1011,7 @@ object SymDenotations {
10021011 s " $kindString $name"
10031012 }
10041013
1005- def debugString = toString+ " #" + symbol.id // !!! DEBUG
1014+ def debugString = toString + " #" + symbol.id // !!! DEBUG
10061015
10071016 // ----- copies and transforms ----------------------------------------
10081017
@@ -1097,8 +1106,8 @@ object SymDenotations {
10971106
10981107 private var firstRunId : RunId = initRunId
10991108
1100- /** If caches influenced by parent classes are still valid, the denotation
1101- * itself, otherwise a freshly initialized copy .
1109+ /** invalidate caches influenced by parent classes if one of the parents
1110+ * is younger than the denotation itself .
11021111 */
11031112 override def syncWithParents (implicit ctx : Context ): SingleDenotation = {
11041113 def isYounger (tref : TypeRef ) = tref.symbol.denot match {
@@ -1124,7 +1133,7 @@ object SymDenotations {
11241133 }
11251134
11261135 /** Invalidate all caches and fields that depend on base classes and their contents */
1127- private def invalidateInheritedInfo (): Unit = {
1136+ override def invalidateInheritedInfo (): Unit = {
11281137 myBaseClasses = null
11291138 mySuperClassBits = null
11301139 myMemberFingerPrint = FingerPrint .unknown
@@ -1168,7 +1177,7 @@ object SymDenotations {
11681177 private [this ] var myBaseClasses : List [ClassSymbol ] = null
11691178 private [this ] var mySuperClassBits : BitSet = null
11701179
1171- /** Invalidate baseTypeRefCache, baseClasses and superClassBits on new run */
1180+ /** Invalidate baseTypeRefCache, baseClasses and superClassBits on new run */
11721181 private def checkBasesUpToDate ()(implicit ctx : Context ) =
11731182 if (baseTypeRefValid != ctx.runId) {
11741183 baseTypeRefCache = new java.util.HashMap [CachedType , Type ]
0 commit comments