File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -420,6 +420,9 @@ object Symbols {
420420 pos.exists && defRunId == ctx.runId
421421 }
422422
423+ final def isValidInCurrentRun (implicit ctx : Context ): Boolean =
424+ lastDenot.validFor.runId == ctx.runId || ctx.stillValid(lastDenot)
425+
423426 /** Subclass tests and casts */
424427 final def isTerm (implicit ctx : Context ): Boolean =
425428 (if (defRunId == ctx.runId) lastDenot else denot).isTerm
Original file line number Diff line number Diff line change @@ -1570,7 +1570,7 @@ object Types {
15701570 val d = lastDenotation match {
15711571 case null =>
15721572 val sym = lastSymbol
1573- if (sym == null ) loadDenot else denotOfSym(sym)
1573+ if (sym != null && sym.isValidInCurrentRun) denotOfSym(sym) else loadDenot
15741574 case d : SymDenotation =>
15751575 if (this .isInstanceOf [WithFixedSym ]) d.current
15761576 else if (d.validFor.runId == ctx.runId || ctx.stillValid(d))
@@ -1734,14 +1734,12 @@ object Types {
17341734 if (reduced.exists) reduced else this
17351735 }
17361736
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)
17421740 lastSymbol
1743- else denot.symbol
1744- }
1741+ else
1742+ denot.symbol
17451743
17461744 /** Retrieves currently valid symbol without necessarily updating denotation.
17471745 * Assumes that symbols do not change between periods in the same run.
You can’t perform that action at this time.
0 commit comments