aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/core/Contexts.scala2
-rw-r--r--src/dotty/tools/dotc/core/Symbols.scala2
-rw-r--r--src/dotty/tools/dotc/core/TyperState.scala2
-rw-r--r--src/dotty/tools/dotc/reporting/Reporter.scala5
-rw-r--r--src/dotty/tools/dotc/reporting/ThrowingReporter.scala4
5 files changed, 9 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala
index 841b83376..761f7764e 100644
--- a/src/dotty/tools/dotc/core/Contexts.scala
+++ b/src/dotty/tools/dotc/core/Contexts.scala
@@ -320,7 +320,7 @@ object Contexts {
outer = NoContext
period = InitialPeriod
mode = Mode.None
- typerState = new TyperState(new ConsoleReporter()(this))
+ typerState = new TyperState(new ThrowingReporter(new ConsoleReporter()(this)))
printerFn = new RefinedPrinter(_)
owner = NoSymbol
sstate = settings.defaultState
diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala
index fe39135d9..d0d517c19 100644
--- a/src/dotty/tools/dotc/core/Symbols.scala
+++ b/src/dotty/tools/dotc/core/Symbols.scala
@@ -368,7 +368,7 @@ object Symbols {
* the class containing this symbol was generated, null if not applicable.
* Overridden in ClassSymbol
*/
- def associatedFile(implicit ctx: Context): AbstractFile =
+ def associatedFile(implicit ctx: Context): AbstractFile =
denot.topLevelClass.symbol.associatedFile
/** The class file from which this class was generated, null if not applicable. */
diff --git a/src/dotty/tools/dotc/core/TyperState.scala b/src/dotty/tools/dotc/core/TyperState.scala
index d14f6c24b..f7631fa22 100644
--- a/src/dotty/tools/dotc/core/TyperState.scala
+++ b/src/dotty/tools/dotc/core/TyperState.scala
@@ -11,7 +11,7 @@ import printing.{Showable, Printer}
import printing.Texts._
import annotation.elidable
-class TyperState(val reporter: Reporter = ThrowingReporter) extends DotClass with Showable {
+class TyperState(val reporter: Reporter) extends DotClass with Showable {
/** The current constraint set */
def constraint: Constraint = new Constraint(SimpleMap.Empty)
diff --git a/src/dotty/tools/dotc/reporting/Reporter.scala b/src/dotty/tools/dotc/reporting/Reporter.scala
index 03249a082..9ef16d67a 100644
--- a/src/dotty/tools/dotc/reporting/Reporter.scala
+++ b/src/dotty/tools/dotc/reporting/Reporter.scala
@@ -127,7 +127,10 @@ trait Reporting { this: Context =>
if (this.settings.debug.value) warning(msg, pos)
def debugTraceIndented[T](question: => String)(op: => T): T =
- if (this.settings.debugTrace.value) traceIndented(question)(op)
+ conditionalTraceIndented(this.settings.debugTrace.value, question)(op)
+
+ def conditionalTraceIndented[T](cond: Boolean, question: => String, show: Boolean = false)(op: => T): T =
+ if (cond) traceIndented(question, show)(op)
else op
def traceIndented[T](question: => String, show: Boolean = false)(op: => T): T = {
diff --git a/src/dotty/tools/dotc/reporting/ThrowingReporter.scala b/src/dotty/tools/dotc/reporting/ThrowingReporter.scala
index f1ee8ddb7..d44a08fb6 100644
--- a/src/dotty/tools/dotc/reporting/ThrowingReporter.scala
+++ b/src/dotty/tools/dotc/reporting/ThrowingReporter.scala
@@ -9,7 +9,7 @@ import Reporter._
/**
* This class implements a Reporter that stores all messages
*/
-object ThrowingReporter extends Reporter {
+class ThrowingReporter(reportInfo: Reporter) extends Reporter {
protected def doReport(d: Diagnostic)(implicit ctx: Context): Unit =
- if (d.severity == ERROR) throw d else println(d)
+ if (d.severity == ERROR) throw d else reportInfo.report(d)
}