summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-02-05 00:46:58 +0100
committerHubert Plociniczak <hubert.plociniczak@gmail.com>2013-02-08 17:51:43 +0100
commite0068b908517768e900a3945e483e9c379d728d8 (patch)
tree680ac5fb751dc183c70a2db6f73670a041dd1c95 /src
parent8d25d05e9bf848d763e7b657d9c7e96ea5cb8daf (diff)
downloadscala-e0068b908517768e900a3945e483e9c379d728d8.tar.gz
scala-e0068b908517768e900a3945e483e9c379d728d8.tar.bz2
scala-e0068b908517768e900a3945e483e9c379d728d8.zip
SI-5675 Discard duplicate feature warnings at a position
When -feature has not been enabled, we were double counting identical feature warnings that were emitted at the same position. Normal error reporting only reports the first time a warning appears at a position; feature warning counter incrementing should behave the same way. @hubertp: Fixed .check files that were broken in the original commit.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 757ac94dbd..116684c161 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -1193,13 +1193,13 @@ class Global(var currentSettings: Settings, var reporter: Reporter)
/** Collects for certain classes of warnings during this run. */
class ConditionalWarning(what: String, option: Settings#BooleanSetting) {
- val warnings = new mutable.ListBuffer[(Position, String)]
+ val warnings = mutable.LinkedHashMap[Position, String]()
def warn(pos: Position, msg: String) =
if (option.value) reporter.warning(pos, msg)
- else warnings += ((pos, msg))
+ else if (!(warnings contains pos)) warnings += ((pos, msg))
def summarize() =
if (option.isDefault && warnings.nonEmpty)
- reporter.warning(NoPosition, "there were %d %s warnings; re-run with %s for details".format(warnings.size, what, option.name))
+ reporter.warning(NoPosition, "there were %d %s warning(s); re-run with %s for details".format(warnings.size, what, option.name))
}
def newUnitParser(code: String) = new syntaxAnalyzer.UnitParser(newCompilationUnit(code))