File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
compiler/src/dotty/tools/dotc/transform/init Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -290,13 +290,17 @@ object Semantic {
290290 if current.contains(value, expr) then current(value)(expr)
291291 else stable(value)(expr)
292292
293- def assume (value : Value , expr : Tree , cacheResult : Boolean )(fun : => Result ): Result =
294- val assumeValue =
293+ def assume (value : Value , expr : Tree , cacheResult : Boolean )(fun : => Result )( using Heap ) : Result =
294+ val assumeValue : Value =
295295 if last.contains(value, expr) then
296- last.get(value, expr)
296+ // Due to heap reverting, the object corresponding to a reference may not exist in the heap.
297+ last.get(value, expr) match
298+ case ref : Ref => ref.ensureObjectExists(); ref
299+ case v => v
297300 else
298301 last.put(value, expr, Hot )
299302 Hot
303+ end if
300304 current.put(value, expr, assumeValue)
301305
302306 val actual = fun
@@ -316,7 +320,10 @@ object Semantic {
316320 actual
317321 end assume
318322
319- /** Commit current cache to stable cache. */
323+ /** Commit current cache to stable cache.
324+ *
325+ * TODO: It's useless to cache value for ThisRef.
326+ */
320327 def commit () =
321328 current.foreach { (v, m) =>
322329 m.iterator.foreach { (e, res) =>
You can’t perform that action at this time.
0 commit comments