From 2c612c3c0e4d2d2be7cc7ba50d6c4f0d63c86050 Mon Sep 17 00:00:00 2001 From: Ashwin Bhaskar Date: Sun, 18 Aug 2019 12:05:09 +0530 Subject: [PATCH] Fixes #7051 Detect typos in neg tests and give a warning --- compiler/test/dotty/tools/vulpix/ParallelTesting.scala | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala index 73cb662edcec..e6be248a41fa 100644 --- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala +++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala @@ -658,6 +658,7 @@ trait ParallelTesting extends RunnerOrchestration { self => if (errors > 0) errorMap.put(s"${file.getPath}:${lineNbr}", errors) + val noposErrors = line.sliding("// nopos-error".length).count(_.mkString == "// nopos-error") if (noposErrors > 0) { val nopos = errorMap.get("nopos") @@ -665,6 +666,12 @@ trait ParallelTesting extends RunnerOrchestration { self => errorMap.put("nopos", noposErrors + existing) } + val possibleTypos = List("//error" -> "// error" , "//nopos-error" -> "// nopos-error") + for ((possibleTypo, expected) <- possibleTypos) { + if (line.contains(possibleTypo)) + echo(s"Warning: Possible typo in error tag in file ${file.getCanonicalPath}:$lineNbr: found `$possibleTypo` but expected `$expected`") + } + expectedErrors += noposErrors + errors } }