Skip to content

Commit 6f6751d

Browse files
Merge pull request #7062 from ashwinbhaskar/neg_test_fix
Fixes #7051 Detect typos in neg tests and give a warning
2 parents 1f22a40 + 2c612c3 commit 6f6751d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,13 +658,20 @@ trait ParallelTesting extends RunnerOrchestration { self =>
658658
if (errors > 0)
659659
errorMap.put(s"${file.getPath}:${lineNbr}", errors)
660660

661+
661662
val noposErrors = line.sliding("// nopos-error".length).count(_.mkString == "// nopos-error")
662663
if (noposErrors > 0) {
663664
val nopos = errorMap.get("nopos")
664665
val existing: Integer = if (nopos eq null) 0 else nopos
665666
errorMap.put("nopos", noposErrors + existing)
666667
}
667668

669+
val possibleTypos = List("//error" -> "// error" , "//nopos-error" -> "// nopos-error")
670+
for ((possibleTypo, expected) <- possibleTypos) {
671+
if (line.contains(possibleTypo))
672+
echo(s"Warning: Possible typo in error tag in file ${file.getCanonicalPath}:$lineNbr: found `$possibleTypo` but expected `$expected`")
673+
}
674+
668675
expectedErrors += noposErrors + errors
669676
}
670677
}

0 commit comments

Comments
 (0)