Skip to content

Commit e1de4a9

Browse files
committed
Compiler: use the reporter passed from the Driver
With this commit and the previous one, partest should finally correctly log the output of the compiler and display it at the end of its execution if compilation failed. Also make sure the initial Reporter in a Context is _not_ a ThrowingReporter. Previously, the initial Reporter was always overriden in Compiler by rootReporter so it had no effect, but this is not the case anymore, and the negative junit tests fail with the ThrowingReporter since they throw an exception instead of exiting with a certain number of errors.
1 parent 2a5171b commit e1de4a9

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/dotty/tools/dotc/Compiler.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,13 @@ class Compiler {
111111
.setOwner(defn.RootClass)
112112
.setTyper(new Typer)
113113
.setMode(Mode.ImplicitsEnabled)
114-
.setTyperState(new MutableTyperState(ctx.typerState, rootReporter(ctx), isCommittable = true))
114+
.setTyperState(new MutableTyperState(ctx.typerState, ctx.typerState.reporter, isCommittable = true))
115115
ctx.definitions.init(start) // set context of definitions to start
116116
def addImport(ctx: Context, refFn: () => TermRef) =
117117
ctx.fresh.setImportInfo(ImportInfo.rootImport(refFn)(ctx))
118118
(start.setRunInfo(new RunInfo(start)) /: defn.RootImportFns)(addImport)
119119
}
120120

121-
protected def rootReporter(implicit ctx: Context): Reporter = new ConsoleReporter()
122-
123121
def reset()(implicit ctx: Context): Unit = {
124122
ctx.base.reset()
125123
ctx.runInfo.clear()

src/dotty/tools/dotc/core/Contexts.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ object Contexts {
481481
outer = NoContext
482482
period = InitialPeriod
483483
mode = Mode.None
484-
typerState = new TyperState(new ThrowingReporter(new ConsoleReporter()))
484+
typerState = new TyperState(new ConsoleReporter())
485485
printerFn = new RefinedPrinter(_)
486486
owner = NoSymbol
487487
sstate = settings.defaultState

0 commit comments

Comments
 (0)