Skip to content

Commit d648fd1

Browse files
committed
Document caches for inherited info
1 parent 91c9013 commit d648fd1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,6 @@ object SymDenotations {
11761176
val annotations1 = if (annotations != null) annotations else this.annotations
11771177
val d = ctx.SymDenotation(symbol, owner, name, initFlags1, info1, privateWithin1)
11781178
d.annotations = annotations1
1179-
// TODO: Copy memberCache if info does not change
11801179
d
11811180
}
11821181

@@ -1911,12 +1910,20 @@ object SymDenotations {
19111910

19121911
// ---- Caches for inherited info -----------------------------------------
19131912

1913+
/** Base trait for caches that keep info dependent on inherited classes */
19141914
trait InheritedCache {
1915+
1916+
/** Is the cache valid in current period? */
19151917
def isValid(implicit ctx: Context): Boolean
1918+
1919+
/** is the cache valid in current run at given phase? */
19161920
def isValidAt(phase: Phase)(implicit ctx: Context): Boolean
1921+
1922+
/** Render invalid this cache and all cache that depend on it */
19171923
def invalidate(): Unit
19181924
}
19191925

1926+
/** A cache for sets of member names, indexed by a NameFilter */
19201927
trait MemberNames extends InheritedCache {
19211928
def apply(keepOnly: NameFilter, clsd: ClassDenotation)
19221929
(implicit onBehalf: MemberNames, ctx: Context): Set[Name]
@@ -1929,6 +1936,9 @@ object SymDenotations {
19291936
def newCache()(implicit ctx: Context): MemberNames = new MemberNamesImpl(ctx.period)
19301937
}
19311938

1939+
/** A cache for baseclasses, as a sequence in linearization order and as a set that
1940+
* can be queried efficiently for containment.
1941+
*/
19321942
trait BaseData extends InheritedCache {
19331943
def apply(clsd: ClassDenotation)
19341944
(implicit onBehalf: BaseData, ctx: Context): (List[ClassSymbol], BaseClassSet)

0 commit comments

Comments
 (0)