@@ -20,6 +20,7 @@ import java.io.{BufferedWriter, OutputStreamWriter}
20
20
import printing .XprintMode
21
21
import parsing .Parsers .Parser
22
22
import typer .ImplicitRunInfo
23
+ import collection .mutable
23
24
24
25
import scala .annotation .tailrec
25
26
import dotty .tools .io .VirtualFile
@@ -68,6 +69,12 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
68
69
private [this ] var myUnitsCached : List [CompilationUnit ] = _
69
70
private [this ] var myFiles : Set [AbstractFile ] = _
70
71
72
+ /** Units that are added because of source completers but that are not
73
+ * compiled in current run.
74
+ */
75
+ val lateUnits = mutable.ListBuffer [CompilationUnit ]()
76
+ var lateFiles = mutable.Set [AbstractFile ]()
77
+
71
78
/** The compilation units currently being compiled, this may return different
72
79
* results over time.
73
80
*/
@@ -175,8 +182,10 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
175
182
* The newly added symbols replace any previously entered symbols.
176
183
*/
177
184
def enterRoots (file : AbstractFile )(implicit ctx : Context ): Unit =
178
- if (! files.contains(file)) {
185
+ if (! files.contains(file) && ! lateFiles.contains(file) ) {
179
186
val unit = new CompilationUnit (getSource(file.path))
187
+ lateUnits += unit
188
+ lateFiles += file
180
189
enterRoots(unit)(runContext.fresh.setCompilationUnit(unit))
181
190
}
182
191
0 commit comments