Skip to content

Commit ec1b115

Browse files
authored
Avoid import suggestion thread hang if -Ximport-suggestion-timeout <= 1 (#21434)
2 parents 8ac201a + 345bfc6 commit ec1b115

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ trait ImportSuggestions:
148148
* `name` that are applicable to `T`.
149149
*/
150150
private def importSuggestions(pt: Type)(using Context): (List[TermRef], List[TermRef]) =
151-
val timer = new Timer()
152151
val allotted = ctx.run.nn.importSuggestionBudget
153152
if allotted <= 1 then return (Nil, Nil)
153+
val timer = new Timer()
154154
implicits.println(i"looking for import suggestions, timeout = ${allotted}ms")
155155
val start = System.currentTimeMillis()
156156
val deadLine = start + allotted

0 commit comments

Comments
 (0)