Skip to content

Commit 1bfab07

Browse files
committed
Invalidate base type caches only if runId changes
Phase-ids should not change base type caches. Instead we make sure that class denotations that contain base type caches are copied whenever base types might change.
1 parent a05963e commit 1bfab07

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ object DenotTransformers {
5050
}
5151
}
5252

53-
/** Denotations with a symbol where `mayChange` is false are guaranteed to be
53+
/** Denotations with a symbol where `infoMayChange` is false are guaranteed to be
5454
* unaffected by this transform, so `transformInfo` need not be run. This
5555
* can save time, and more importantly, can help avoid forcing symbol completers.
5656
*/

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -2641,7 +2641,11 @@ object SymDenotations {
26412641
private var locked = false
26422642
private var provisional = false
26432643

2644-
final def isValid(using Context): Boolean = valid && isValidAt(ctx.phase)
2644+
final def isValid(using Context): Boolean =
2645+
valid && createdAt.runId == ctx.runId
2646+
// Note: We rely on the fact that whenever base types of classes change,
2647+
// the affected classes will get new denotations with new basedata caches.
2648+
// So basedata caches can become invalid only if the run changes.
26452649

26462650
def invalidate(): Unit =
26472651
if (valid && !locked) {

0 commit comments

Comments
 (0)