aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/reporting/ConsoleReporter.scala
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-09-15 22:28:30 +0200
committerFelix Mulder <felix.mulder@gmail.com>2016-10-10 13:25:33 +0200
commitf8456fc71e0fba8c92eb2069a7abc872a59c2567 (patch)
tree15011455f12c1be921305dc73ee9a6ed6dce0731 /src/dotty/tools/dotc/reporting/ConsoleReporter.scala
parent15db5f6053badd49aae62a699aa59745288c932d (diff)
downloaddotty-f8456fc71e0fba8c92eb2069a7abc872a59c2567.tar.gz
dotty-f8456fc71e0fba8c92eb2069a7abc872a59c2567.tar.bz2
dotty-f8456fc71e0fba8c92eb2069a7abc872a59c2567.zip
Add error kind to diagnostic
Diffstat (limited to 'src/dotty/tools/dotc/reporting/ConsoleReporter.scala')
-rw-r--r--src/dotty/tools/dotc/reporting/ConsoleReporter.scala22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/dotty/tools/dotc/reporting/ConsoleReporter.scala b/src/dotty/tools/dotc/reporting/ConsoleReporter.scala
index a681c1552..5db549b7b 100644
--- a/src/dotty/tools/dotc/reporting/ConsoleReporter.scala
+++ b/src/dotty/tools/dotc/reporting/ConsoleReporter.scala
@@ -22,17 +22,6 @@ class ConsoleReporter(
/** maximal number of error messages to be printed */
protected def ErrorLimit = 100
-<<<<<<< HEAD
- def printPos(pos: SourcePosition): Unit =
- if (pos.exists) {
- printMessage(pos.lineContent.stripLineEnd)
- printMessage(" " * pos.column + "^")
- if (pos.outer.exists) {
- printMessage(s"\n... this location is in code that was inlined at ${pos.outer}:\n")
- printPos(pos.outer)
- }
- }
-=======
def sourceLine(pos: SourcePosition): (String, Int) = {
val lineNum = s"${pos.line}:"
(lineNum + hl"${pos.lineContent.stripLineEnd}", lineNum.length)
@@ -78,8 +67,9 @@ class ConsoleReporter(
printStr(pos.outer) + "\n" + "-" * ctx.settings.pageWidth.value
} else ""
- s"${Console.CYAN}$kind: $file " +
- "-" * math.max(ctx.settings.pageWidth.value - file.length - kind.length - 1, 0) +
+ val prefix = s"${Console.CYAN}-- $kind: $file "
+ prefix +
+ ("-" * math.max(ctx.settings.pageWidth.value - prefix.replaceAll("\u001B\\[[;\\d]*m", "").length, 0)) +
"\n" + outer + NoColor
}
else ""
@@ -101,13 +91,13 @@ class ConsoleReporter(
override def doReport(d: Diagnostic)(implicit ctx: Context): Unit = d match {
case d: Error =>
- printMessageAndPos(d.message, d.pos, "Error in")
+ printMessageAndPos(d.message, d.pos, d.kind)
if (ctx.settings.prompt.value) displayPrompt()
case d: ConditionalWarning if !d.enablingOption.value =>
case d: MigrationWarning =>
- printMessageAndPos(d.message, d.pos, "Migration Warning in")
+ printMessageAndPos(d.message, d.pos, d.kind)
case d: Warning =>
- printMessageAndPos(d.message, d.pos, "Warning in")
+ printMessageAndPos(d.message, d.pos, d.kind)
case _ =>
printMessageAndPos(d.message, d.pos)
}