Skip to content

Commit dc96bb6

Browse files
committed
Fix timeout config
Avoid referring to config option before it is initialized
1 parent 17f4213 commit dc96bb6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

compiler/src/dotty/tools/dotc/Run.scala

+9-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
3535
* This is usually for the first import suggestion; subsequent suggestions
3636
* may get smaller timeouts. @see ImportSuggestions.reduceTimeBudget
3737
*/
38-
var importSuggestionBudget: Int = ictx.settings.XimportSuggestionTimeout.value
38+
private var myImportSuggestionBudget: Int =
39+
Int.MinValue // sentinel value; means whatever is set in command line option
40+
41+
def importSuggestionBudget =
42+
if myImportSuggestionBudget == Int.MinValue then ictx.settings.XimportSuggestionTimeout.value
43+
else myImportSuggestionBudget
44+
45+
def importSuggestionBudget_=(x: Int) =
46+
myImportSuggestionBudget = x
3947

4048
/** If this variable is set to `true`, some core typer operations will
4149
* return immediately. Currently these early abort operations are

0 commit comments

Comments
 (0)