Skip to content

Commit a8c3d25

Browse files
Checkfiles use actual error message format
1 parent 3ef991d commit a8c3d25

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

compiler/test/dotty/tools/dotc/reporting/TestReporter.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ class TestReporter protected (outWriter: PrintWriter, filePrintln: String => Uni
2020
extends Reporter with UniqueMessagePositions with HideNonSensicalMessages with MessageRendering {
2121
import MessageContainer._
2222

23-
protected final val _errorBuf = mutable.ArrayBuffer.empty[MessageContainer]
24-
final def errors: Iterator[MessageContainer] = _errorBuf.iterator
23+
protected final val _errorBuf = mutable.ArrayBuffer.empty[(MessageContainer, String)]
24+
final def errors: Iterator[(MessageContainer, String)] = _errorBuf.iterator
25+
def logError(err: Error)(implicit ctx: Context) =
26+
_errorBuf.append(err -> messageAndPos(err.contained(), err.pos, diagnosticLevel(err)))
2527

2628
protected final val _messageBuf = mutable.ArrayBuffer.empty[String]
2729
final def messages: Iterator[String] = _messageBuf.iterator
@@ -71,7 +73,7 @@ extends Reporter with UniqueMessagePositions with HideNonSensicalMessages with M
7173

7274
m match {
7375
case m: Error => {
74-
_errorBuf.append(m)
76+
logError(m)
7577
printMessageAndPos(m, extra)
7678
}
7779
case m =>

compiler/test/dotty/tools/vulpix/ParallelTesting.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
638638
def compilerCrashed = reporters.exists(_.compilerCrashed)
639639
lazy val (errorMap, expectedErrors) = getErrorMapAndExpectedCount(testSource.sourceFiles)
640640
lazy val actualErrors = reporters.foldLeft(0)(_ + _.errorCount)
641-
def hasMissingAnnotations = getMissingExpectedErrors(errorMap, reporters.iterator.flatMap(_.errors))
641+
def hasMissingAnnotations = getMissingExpectedErrors(errorMap, reporters.iterator.flatMap(_.errors).map(_._1))
642642

643643
if (compilerCrashed) Some(s"Compiler crashed when compiling: ${testSource.title}" )
644644
else if (actualErrors == 0) Some(s"\nNo errors found when compiling neg test $testSource" )
@@ -652,8 +652,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
652652
checkFile(testSource).foreach(diffTest(testSource, _, reporterOutputLines(reporters)))
653653

654654
def reporterOutputLines(reporters: Seq[TestReporter]): List[String] =
655-
reporters.flatMap(_.allErrors).sortBy(_.pos.source.toString).flatMap { error =>
656-
(error.pos.span.toString + " in " + error.pos.source.file.name) :: error.getMessage().linesIterator.toList }.toList
655+
reporters.flatMap(_.errors).sortBy(_._1.pos.source.toString).map(_._2).toList
657656

658657
// In neg-tests we allow two types of error annotations,
659658
// "nopos-error" which doesn't care about position and "error" which

0 commit comments

Comments
 (0)