Skip to content

Commit 3aeec39

Browse files
committed
Add nopos-warns
1 parent 9858d79 commit 3aeec39

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
776776
end maybeFailureMessage
777777

778778
def getWarnMapAndExpectedCount(files: Seq[JFile]): (HashMap[String, Integer], Int) =
779-
val comment = raw"//( *)warn".r
779+
val comment = raw"//( *)(nopos-)?warn".r
780780
val map = new HashMap[String, Integer]()
781781
var count = 0
782782
def bump(key: String): Unit =
@@ -787,8 +787,11 @@ trait ParallelTesting extends RunnerOrchestration { self =>
787787
files.filter(isSourceFile).foreach { file =>
788788
Using(Source.fromFile(file, StandardCharsets.UTF_8.name)) { source =>
789789
source.getLines.zipWithIndex.foreach { case (line, lineNbr) =>
790-
comment.findAllMatchIn(line).foreach { _ =>
791-
bump(s"${file.getPath}:${lineNbr+1}")
790+
comment.findAllMatchIn(line).foreach { m =>
791+
m.group(2) match
792+
case "nopos-" =>
793+
bump("nopos")
794+
case _ => bump(s"${file.getPath}:${lineNbr+1}")
792795
}
793796
}
794797
}.get
@@ -809,8 +812,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
809812
val key = s"${relativize(srcpos.source.file.toString())}:${srcpos.line + 1}"
810813
if !seenAt(key) then unexpected += key
811814
else
812-
unpositioned += relativize(srcpos.source.file.toString())
813-
815+
if(!seenAt("nopos")) unpositioned += relativize(srcpos.source.file.toString())
814816
reporterWarnings.foreach(sawDiagnostic)
815817

816818
(map.asScala.keys.toList, (unexpected ++ unpositioned).toList)

tests/warn/i13440.check

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
5 |def given = 42 // warn
33
| ^
44
| given is now a keyword, write `given` instead of given to keep it as an identifier
5+
| This can be rewritten automatically under -rewrite -source 3.0-migration.
56
-- Migration Warning: tests/warn/i13440.scala:7:13 ---------------------------------------------------------------------
67
7 |case class C(enum: List[Int] = Nil) { // warn
78
| ^
89
| enum is now a keyword, write `enum` instead of enum to keep it as an identifier
10+
| This can be rewritten automatically under -rewrite -source 3.0-migration.
911
-- Migration Warning: tests/warn/i13440.scala:8:11 ---------------------------------------------------------------------
1012
8 | val s = s"$enum" // warn
1113
| ^

0 commit comments

Comments
 (0)