Skip to content

Commit 8d03e8c

Browse files
committed
Avoid losing the symbols denotation on update
1 parent 6dc87fe commit 8d03e8c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,23 @@ object Symbols {
110110
private def computeDenot(lastd: SymDenotation)(using Context): SymDenotation = {
111111
util.Stats.record("Symbol.computeDenot")
112112
val now = ctx.period
113+
val prev = checkedPeriod
113114
checkedPeriod = now
114-
if (lastd.validFor contains now) lastd else recomputeDenot(lastd)
115+
if lastd.validFor.contains(now) then
116+
lastd
117+
else
118+
val newd = recomputeDenot(lastd)
119+
if newd.exists then
120+
lastDenot = newd
121+
else
122+
checkedPeriod = prev
123+
newd
115124
}
116125

117126
/** Overridden in NoSymbol */
118127
protected def recomputeDenot(lastd: SymDenotation)(using Context): SymDenotation = {
119128
util.Stats.record("Symbol.recomputeDenot")
120-
val newd = lastd.current.asInstanceOf[SymDenotation]
121-
lastDenot = newd
122-
newd
129+
lastd.current.asSymDenotation
123130
}
124131

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

0 commit comments

Comments
 (0)