Skip to content

Commit 6ed401c

Browse files
committed
Try to avoid datarace involving NoDenotation
The thread-shared value NoDenotation has a validity with run-id that got updated to the run-id of the current thread. This caused a partest failure with a "demanding denotation outside its range" error. We now treat NoDenotation specially in current, hoping this will avoid the condition.
1 parent f7ac8df commit 6ed401c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/dotty/tools/dotc/core/Denotations.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ object Denotations {
556556
*/
557557
private def bringForward()(implicit ctx: Context): SingleDenotation = this match {
558558
case denot: SymDenotation if ctx.stillValid(denot) =>
559-
if (denot.exists) assert(ctx.runId > validFor.runId, s"denotation $denot invalid in run ${ctx.runId}. ValidFor: $validFor")
559+
assert(ctx.runId > validFor.runId, s"denotation $denot invalid in run ${ctx.runId}. ValidFor: $validFor")
560560
var d: SingleDenotation = denot
561561
do {
562562
d.validFor = Period(ctx.period.runId, d.validFor.firstPhaseId, d.validFor.lastPhaseId)
@@ -592,7 +592,9 @@ object Denotations {
592592
assert(false)
593593
}
594594

595-
if (valid.runId != currentPeriod.runId) initial.bringForward.current
595+
if (valid.runId != currentPeriod.runId)
596+
if (exists) initial.bringForward.current
597+
else this
596598
else {
597599
var cur = this
598600
if (currentPeriod.code > valid.code) {

0 commit comments

Comments
 (0)