@@ -12,7 +12,7 @@ import typer.Typer
1212import typer .ImportInfo .withRootImports
1313import Decorators .*
1414import io .AbstractFile
15- import Phases .{unfusedPhases , Phase }
15+ import Phases .{assemblePhases , unfusedPhases , Phase }
1616
1717import sbt .interfaces .ProgressCallback
1818
@@ -270,19 +270,12 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
270270 report.echo(this .enrichErrorMessage(s " exception occurred while compiling ${files1.map(_.path)}" ))
271271 throw ex
272272
273- /** TODO: There's a fundamental design problem here: We assemble phases using `fusePhases`
274- * when we first build the compiler. But we modify them with -Yskip, -Ystop
275- * on each run. That modification needs to either transform the tree structure,
276- * or we need to assemble phases on each run, and take -Yskip, -Ystop into
277- * account. I think the latter would be preferable.
278- */
279273 def compileSources (sources : List [SourceFile ]): Unit =
280274 if (sources forall (_.exists)) {
281275 units = sources.map(CompilationUnit (_))
282276 compileUnits()
283277 }
284278
285-
286279 def compileUnits (us : List [CompilationUnit ]): Unit = {
287280 units = us
288281 compileUnits()
@@ -308,23 +301,9 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
308301 then ActiveProfile (ctx.settings.VprofileDetails .value.max(0 ).min(1000 ))
309302 else NoProfile
310303
311- // If testing pickler, make sure to stop after pickling phase:
312- val stopAfter =
313- if (ctx.settings.YtestPickler .value) List (" pickler" )
314- else ctx.settings.YstopAfter .value
315-
316- val runCtx = ctx.fresh
304+ val runCtx = assemblePhases()
317305 runCtx.setProfiler(Profiler ())
318306
319- val pluginPlan = ctx.base.addPluginPhases(ctx.base.phasePlan)
320- val phases = ctx.base.fusePhases(pluginPlan,
321- ctx.settings.Yskip .value, ctx.settings.YstopBefore .value, stopAfter, ctx.settings.Ycheck .value)
322- ctx.base.usePhases(phases, runCtx)
323- val phasesSettings = List (" -Vphases" , " -Vprint" )
324- for phasesSetting <- ctx.settings.allSettings if phasesSettings.contains(phasesSetting.name) do
325- for case vs : List [String ] <- phasesSetting.userValue; p <- vs do
326- if ! phases.exists(List (p).containsPhase) then report.warning(s " ' $p' specifies no phase " )
327-
328307 if ctx.settings.YnoDoubleBindings .value then
329308 ctx.base.checkNoDoubleBindings = true
330309
@@ -334,7 +313,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
334313 var phasesWereAdjusted = false
335314
336315 var forceReachPhaseMaybe =
337- if (ctx.isBestEffort && phases .exists(_.phaseName == " typer" )) Some (" typer" )
316+ if (ctx.isBestEffort && allPhases .exists(_.phaseName == " typer" )) Some (" typer" )
338317 else None
339318
340319 for phase <- allPhases do
0 commit comments