@@ -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
@@ -295,19 +295,12 @@ extends ImplicitRunInfo, ConstraintRunInfo, cc.CaptureRunInfo {
295295 report.echo(this .enrichErrorMessage(s " exception occurred while compiling ${files1.map(_.path)}" ))
296296 throw ex
297297
298- /** TODO: There's a fundamental design problem here: We assemble phases using `fusePhases`
299- * when we first build the compiler. But we modify them with -Yskip, -Ystop
300- * on each run. That modification needs to either transform the tree structure,
301- * or we need to assemble phases on each run, and take -Yskip, -Ystop into
302- * account. I think the latter would be preferable.
303- */
304298 def compileSources (sources : List [SourceFile ]): Unit =
305299 if (sources forall (_.exists)) {
306300 units = sources.map(CompilationUnit (_))
307301 compileUnits()
308302 }
309303
310-
311304 def compileUnits (us : List [CompilationUnit ]): Unit = {
312305 units = us
313306 compileUnits()
@@ -333,23 +326,9 @@ extends ImplicitRunInfo, ConstraintRunInfo, cc.CaptureRunInfo {
333326 then ActiveProfile (ctx.settings.VprofileDetails .value.max(0 ).min(1000 ))
334327 else NoProfile
335328
336- // If testing pickler, make sure to stop after pickling phase:
337- val stopAfter =
338- if (ctx.settings.YtestPickler .value) List (" pickler" )
339- else ctx.settings.YstopAfter .value
340-
341- val runCtx = ctx.fresh
329+ val runCtx = assemblePhases()
342330 runCtx.setProfiler(Profiler ())
343331
344- val pluginPlan = ctx.base.addPluginPhases(ctx.base.phasePlan)
345- val phases = ctx.base.fusePhases(pluginPlan,
346- ctx.settings.Yskip .value, ctx.settings.YstopBefore .value, stopAfter, ctx.settings.Ycheck .value)
347- ctx.base.usePhases(phases, runCtx)
348- val phasesSettings = List (" -Vphases" , " -Vprint" )
349- for phasesSetting <- ctx.settings.allSettings if phasesSettings.contains(phasesSetting.name) do
350- for case vs : List [String ] <- phasesSetting.userValue; p <- vs do
351- if ! phases.exists(List (p).containsPhase) then report.warning(s " ' $p' specifies no phase " )
352-
353332 if ctx.settings.YnoDoubleBindings .value then
354333 ctx.base.checkNoDoubleBindings = true
355334
@@ -359,7 +338,7 @@ extends ImplicitRunInfo, ConstraintRunInfo, cc.CaptureRunInfo {
359338 var phasesWereAdjusted = false
360339
361340 var forceReachPhaseMaybe =
362- if (ctx.isBestEffort && phases .exists(_.phaseName == " typer" )) Some (" typer" )
341+ if (ctx.isBestEffort && allPhases .exists(_.phaseName == " typer" )) Some (" typer" )
363342 else None
364343
365344 for phase <- allPhases do
0 commit comments