diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-07-03 13:40:55 +0200 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-07-04 15:49:08 +0200 |
commit | b384d5070f86e9003e8f1b57cc818520033242ab (patch) | |
tree | f511cd45fd3e7783c8b124df3863d1317a8b5af9 /src | |
parent | 3066bd4c7b2f574748208b7399c68c6c6493206b (diff) | |
download | scala-b384d5070f86e9003e8f1b57cc818520033242ab.tar.gz scala-b384d5070f86e9003e8f1b57cc818520033242ab.tar.bz2 scala-b384d5070f86e9003e8f1b57cc818520033242ab.zip |
Use countElementsAsString for summarized warnings.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/Reporting.scala | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/Reporting.scala b/src/compiler/scala/tools/nsc/Reporting.scala index bc27afb0c5..0263586418 100644 --- a/src/compiler/scala/tools/nsc/Reporting.scala +++ b/src/compiler/scala/tools/nsc/Reporting.scala @@ -9,6 +9,7 @@ package nsc import reporters.{ Reporter, ConsoleReporter } import scala.collection.{ mutable, immutable } +import scala.reflect.internal.util.StringOps.countElementsAsString /** Provides delegates to the reporter doing the actual work. * PerRunReporting implements per-Run stateful info tracking and reporting @@ -34,11 +35,10 @@ trait Reporting extends scala.reflect.internal.Reporting { self: ast.Positions w def summarize() = if (warnings.nonEmpty && (option.isDefault || settings.fatalWarnings)) { val numWarnings = warnings.size - val warningEvent = // TODO use scala.reflect.internal.util.StringOps.countElementsAsString(numWarnings, s"$what warning") - if (numWarnings > 1) s"were $numWarnings $what warnings" - else s"was one $what warning" + val warningVerb = if (numWarnings == 1) "was" else "were" + val warningCount = countElementsAsString(numWarnings, s"$what warning") - reporter.warning(NoPosition, s"there $warningEvent; re-run with ${option.name} for details") + reporter.warning(NoPosition, s"there $warningVerb $warningCount; re-run with ${option.name} for details") } } |