Skip to content

Commit 3d3d8aa

Browse files
dwijnandWojciechMazur
authored andcommitted
Avoid losing the symbols denotation on update
[Cherry-picked 4615a9c]
1 parent 858f974 commit 3d3d8aa

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
@@ -107,16 +107,23 @@ object Symbols extends SymUtils {
107107
private def computeDenot(lastd: SymDenotation)(using Context): SymDenotation = {
108108
util.Stats.record("Symbol.computeDenot")
109109
val now = ctx.period
110+
val prev = checkedPeriod
110111
checkedPeriod = now
111-
if (lastd.validFor contains now) lastd else recomputeDenot(lastd)
112+
if lastd.validFor.contains(now) then
113+
lastd
114+
else
115+
val newd = recomputeDenot(lastd)
116+
if newd.exists then
117+
lastDenot = newd
118+
else
119+
checkedPeriod = prev
120+
newd
112121
}
113122

114123
/** Overridden in NoSymbol */
115124
protected def recomputeDenot(lastd: SymDenotation)(using Context): SymDenotation = {
116125
util.Stats.record("Symbol.recomputeDenot")
117-
val newd = lastd.current.asInstanceOf[SymDenotation]
118-
lastDenot = newd
119-
newd
126+
lastd.current.asSymDenotation
120127
}
121128

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

0 commit comments

Comments
 (0)