Skip to content

Commit 2d22ed7

Browse files
authored
Merge pull request #8076 from dotty-staging/fix-#8072
Fix #8072: Synchronize cancelling timer task properly
2 parents 5a86c1f + 1cd30d2 commit 2d22ed7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

compiler/src/dotty/tools/dotc/typer/ImportSuggestions.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,11 @@ trait ImportSuggestions with
186186
typedImplicit(candidate, expectedType, argument, span)(
187187
given ctx.fresh.setExploreTyperState()).isSuccess
188188
finally
189-
task.cancel()
190-
ctx.run.isCancelled = false
189+
if task.cancel() then // timer task has not run yet
190+
assert(!ctx.run.isCancelled)
191+
else
192+
while !ctx.run.isCancelled do () // wait until timer task has run to completion
193+
ctx.run.isCancelled = false
191194
}
192195
end deepTest
193196

0 commit comments

Comments
 (0)