Skip to content
Snippets Groups Projects
Commit 7991aeb5 authored by Etienne Kneuss's avatar Etienne Kneuss
Browse files

Report file name in errors/warnings

Multiple-file benchmarks are getting common nowadays, so we report the
files corresponding to the error to help debugging. File should be
relative to the CWD, when possible, absolute otherwise.
parent 08113e8d
No related branches found
No related tags found
No related merge requests found
......@@ -113,10 +113,24 @@ class DefaultReporter(debugSections: Set[DebugSection]) extends Reporter(debugSe
case DEBUG(_) => "["+Console.MAGENTA +" Debug "+Console.RESET+"]"
}
def smartPos(p: Position): String = {
if (p == NoPosition) {
""
} else {
val target = p.file.getAbsolutePath()
val here = new java.io.File(".").getAbsolutePath().stripSuffix(".")
val diff = target.stripPrefix(here)
val filePos = diff+":"
filePos + p + ": "
}
}
def emit(msg: Message) = {
val posString = if (msg.position != NoPosition) { msg.position+": " } else { "" }
println(reline(severityToPrefix(msg.severity), posString + msg.msg.toString))
println(reline(severityToPrefix(msg.severity), smartPos(msg.position) + msg.msg.toString))
printLineContent(msg.position)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment