Skip to content

Commit

Permalink
Avoid losing the symbols denotation on update
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijnand committed Feb 24, 2024
1 parent 75c9830 commit 097fb65
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions compiler/src/dotty/tools/dotc/core/Symbols.scala
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,23 @@ object Symbols extends SymUtils {
private def computeDenot(lastd: SymDenotation)(using Context): SymDenotation = {
util.Stats.record("Symbol.computeDenot")
val now = ctx.period
val prev = checkedPeriod
checkedPeriod = now
if (lastd.validFor contains now) lastd else recomputeDenot(lastd)
if lastd.validFor.contains(now) then
lastd
else
val newd = recomputeDenot(lastd)
if newd.exists then
lastDenot = newd
else
checkedPeriod = prev
newd
}

/** Overridden in NoSymbol */
protected def recomputeDenot(lastd: SymDenotation)(using Context): SymDenotation = {
util.Stats.record("Symbol.recomputeDenot")
val newd = lastd.current.asInstanceOf[SymDenotation]
lastDenot = newd
newd
lastd.current.asSymDenotation
}

/** The original denotation of this symbol, without forcing anything */
Expand Down

0 comments on commit 097fb65

Please sign in to comment.