Skip to content

Commit bb94056

Browse files
committed
Avoid spurious StaleSymbol error in <refinement> members
Refinement classes and their members could give spurious stale symbol errors if the symbol is loaded in a different run than the classfile containing it. The problem is that refinement classes do not form part of the scope of their owners. The fix assumes that refinement classes are always "stillValid".
1 parent 78fae11 commit bb94056

File tree

4 files changed

+3
-2
lines changed

4 files changed

+3
-2
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ trait SymDenotations { this: Context =>
4040
}
4141

4242
def stillValid(denot: SymDenotation): Boolean =
43-
if (denot is ValidForever) true
43+
if (denot.is(ValidForever) || denot.isRefinementClass) true
4444
else {
4545
val initial = denot.initial
4646
if (initial ne denot)
@@ -49,6 +49,7 @@ trait SymDenotations { this: Context =>
4949
val owner = denot.owner.denot
5050
stillValid(owner) && (
5151
!owner.isClass
52+
|| owner.isRefinementClass
5253
|| (owner.unforcedDecls.lookupAll(denot.name) contains denot.symbol)
5354
|| denot.isSelfSym)
5455
} catch {

src/dotty/tools/dotc/core/Symbols.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ object Symbols {
408408
/** Subclass tests and casts */
409409
final def isTerm(implicit ctx: Context): Boolean =
410410
(if(isDefinedInCurrentRun) lastDenot else denot).isTerm
411-
411+
412412
final def isType(implicit ctx: Context): Boolean =
413413
(if(isDefinedInCurrentRun) lastDenot else denot).isType
414414

0 commit comments

Comments
 (0)