Skip to content

Commit 4615a9c

Browse files
dwijnandodersky
authored andcommitted
Avoid losing the symbols denotation on update
1 parent c2c78d7 commit 4615a9c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

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

+11-4
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,23 @@ object Symbols extends SymUtils {
112112
private def computeDenot(lastd: SymDenotation)(using Context): SymDenotation = {
113113
util.Stats.record("Symbol.computeDenot")
114114
val now = ctx.period
115+
val prev = checkedPeriod
115116
checkedPeriod = now
116-
if (lastd.validFor contains now) lastd else recomputeDenot(lastd)
117+
if lastd.validFor.contains(now) then
118+
lastd
119+
else
120+
val newd = recomputeDenot(lastd)
121+
if newd.exists then
122+
lastDenot = newd
123+
else
124+
checkedPeriod = prev
125+
newd
117126
}
118127

119128
/** Overridden in NoSymbol */
120129
protected def recomputeDenot(lastd: SymDenotation)(using Context): SymDenotation = {
121130
util.Stats.record("Symbol.recomputeDenot")
122-
val newd = lastd.current.asInstanceOf[SymDenotation]
123-
lastDenot = newd
124-
newd
131+
lastd.current.asSymDenotation
125132
}
126133

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

0 commit comments

Comments
 (0)