Skip to content

Commit 72429b2

Browse files
committed
Only update runId when forcing a LazyRef in a map
1 parent 61b8eed commit 72429b2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4980,10 +4980,14 @@ object Types {
49804980

49814981
case tp: LazyRef =>
49824982
LazyRef { c =>
4983-
val saved = mapCtx
4984-
mapCtx = c
4985-
try this(tp.ref(using c))
4986-
finally mapCtx = saved
4983+
val ref1 = tp.ref(using c)
4984+
if c.runId == mapCtx.runId then this(ref1)
4985+
else // splice in new run into map context
4986+
val saved = mapCtx
4987+
mapCtx = mapCtx.fresh
4988+
.setPeriod(Period(c.runId, mapCtx.phaseId))
4989+
.setRun(c.run)
4990+
try this(ref1) finally mapCtx = saved
49874991
}
49884992

49894993
case tp: ClassInfo =>

0 commit comments

Comments
 (0)