File tree 2 files changed +9
-8
lines changed
compiler/src/dotty/tools/dotc/core
2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -420,6 +420,9 @@ object Symbols {
420
420
pos.exists && defRunId == ctx.runId
421
421
}
422
422
423
+ final def isValidInCurrentRun (implicit ctx : Context ): Boolean =
424
+ lastDenot.validFor.runId == ctx.runId || ctx.stillValid(lastDenot)
425
+
423
426
/** Subclass tests and casts */
424
427
final def isTerm (implicit ctx : Context ): Boolean =
425
428
(if (defRunId == ctx.runId) lastDenot else denot).isTerm
Original file line number Diff line number Diff line change @@ -1570,7 +1570,7 @@ object Types {
1570
1570
val d = lastDenotation match {
1571
1571
case null =>
1572
1572
val sym = lastSymbol
1573
- if (sym == null ) loadDenot else denotOfSym(sym)
1573
+ if (sym != null && sym.isValidInCurrentRun) denotOfSym(sym) else loadDenot
1574
1574
case d : SymDenotation =>
1575
1575
if (this .isInstanceOf [WithFixedSym ]) d.current
1576
1576
else if (d.validFor.runId == ctx.runId || ctx.stillValid(d))
@@ -1734,14 +1734,12 @@ object Types {
1734
1734
if (reduced.exists) reduced else this
1735
1735
}
1736
1736
1737
- def symbol (implicit ctx : Context ): Symbol = {
1738
- val now = ctx.period
1739
- if (checkedPeriod == now ||
1740
- lastDenotation == null && lastSymbol != null &&
1741
- (checkedPeriod.runId == now.runId || ctx.stillValid(lastSymbol)))
1737
+ def symbol (implicit ctx : Context ): Symbol =
1738
+ if (checkedPeriod == ctx.period ||
1739
+ lastDenotation == null && lastSymbol != null && lastSymbol.isValidInCurrentRun)
1742
1740
lastSymbol
1743
- else denot.symbol
1744
- }
1741
+ else
1742
+ denot.symbol
1745
1743
1746
1744
/** Retrieves currently valid symbol without necessarily updating denotation.
1747
1745
* Assumes that symbols do not change between periods in the same run.
You can’t perform that action at this time.
0 commit comments