Skip to content

Commit 4e5e764

Browse files
committed
Clarify the comment on filtering compiler summary diagnostics
1 parent da5cf61 commit 4e5e764

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎test-util/src/main/scala-3/com/softwaremill/macwire/CompileTestsSupport.scala‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import java.nio.file.Files
1313
import java.nio.file.StandardOpenOption
1414

1515
import dotty.tools.dotc.reporting.{ThrowingReporter, Diagnostic}
16+
import dotty.tools.dotc.interfaces.Diagnostic.WARNING
1617
import dotty.tools.dotc.Driver
1718
import java.io.IOException
1819

@@ -53,12 +54,11 @@ trait CompileTestsSupport extends BaseCompileTestsSupport with OptionValues {
5354
val classpath = Array("-classpath", Properties.currentClasspath)
5455
driver.process(classpath :+ path.toString, reporter)
5556

56-
// Newer Scala 3 versions (checked with 3.9) also report the "N warnings/errors found" summary is also reported as a (position-less) diagnostic
57-
def isSummary(d: Diagnostic) = !d.pos.exists && d.message.matches("""\S+ (warning|error)s? found""")
58-
val infos = testReporter.storedInfos.filterNot(isSummary)
57+
// since Scala 3.9 update, the "N errors" found summary is reported as a position-less warning
58+
val infosWithoutSummary = testReporter.storedInfos.filterNot(msg => msg.level == WARNING && !msg.pos.exists)
5959

6060
def verifyInfo(level: Int, expected: List[String]) = {
61-
val actual = infos.filter(_.level == level).map(_.message)
61+
val actual = infosWithoutSummary.filter(_.level == level).map(_.message)
6262

6363
if (expected.size > 0) {
6464
val info = actual.mkString("\n")

0 commit comments

Comments
 (0)