summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/Reporting.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2014-06-24 14:34:05 +0200
committerAdriaan Moors <adriaan.moors@typesafe.com>2014-07-04 15:49:08 +0200
commit3066bd4c7b2f574748208b7399c68c6c6493206b (patch)
tree468e6a379198f0236a3e8f7d4918992ec13471ed /src/compiler/scala/tools/nsc/Reporting.scala
parent9fc68e19309cef139c4827fbed76952011995e10 (diff)
downloadscala-3066bd4c7b2f574748208b7399c68c6c6493206b.tar.gz
scala-3066bd4c7b2f574748208b7399c68c6c6493206b.tar.bz2
scala-3066bd4c7b2f574748208b7399c68c6c6493206b.zip
Encapsulate deprecation warning message synthesis.
Both refchecks and typer constructed the same message. But different. Now with more DRYness. Note that no check files had to be updated (disconcerting)...
Diffstat (limited to 'src/compiler/scala/tools/nsc/Reporting.scala')
-rw-r--r--src/compiler/scala/tools/nsc/Reporting.scala6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/Reporting.scala b/src/compiler/scala/tools/nsc/Reporting.scala
index 9a20807145..bc27afb0c5 100644
--- a/src/compiler/scala/tools/nsc/Reporting.scala
+++ b/src/compiler/scala/tools/nsc/Reporting.scala
@@ -15,7 +15,7 @@ import scala.collection.{ mutable, immutable }
*
* TODO: make reporting configurable
*/
-trait Reporting extends scala.reflect.internal.Reporting { self: ast.Positions with CompilationUnits with scala.reflect.api.Symbols =>
+trait Reporting extends scala.reflect.internal.Reporting { self: ast.Positions with CompilationUnits with scala.reflect.internal.Symbols =>
def settings: Settings
// not deprecated yet, but a method called "error" imported into
@@ -65,6 +65,10 @@ trait Reporting extends scala.reflect.internal.Reporting { self: ast.Positions w
// behold! the symbol that caused the deprecation warning (may not be deprecated itself)
def deprecationWarning(pos: Position, sym: Symbol, msg: String): Unit = _deprecationWarnings.warn(pos, msg)
+ def deprecationWarning(pos: Position, sym: Symbol): Unit = {
+ val suffix = sym.deprecationMessage match { case Some(msg) => ": "+ msg case _ => "" }
+ deprecationWarning(pos, sym, s"$sym${sym.locationString} is deprecated$suffix")
+ }
private[this] var reportedFeature = Set[Symbol]()
def featureWarning(pos: Position, featureName: String, featureDesc: String, featureTrait: Symbol, construct: => String = "", required: Boolean): Unit = {