diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-06-10 12:32:06 +0200 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-07-04 15:49:07 +0200 |
commit | e08735380e8cba8f4b7230f5615e528782a0111a (patch) | |
tree | c1719135c315a32db4f921aebbb6d6e0f56eb0a8 /src/compiler/scala/tools/nsc/Reporting.scala | |
parent | 62c8f90f3105b8f19a9f29f104ff232438372c73 (diff) | |
download | scala-e08735380e8cba8f4b7230f5615e528782a0111a.tar.gz scala-e08735380e8cba8f4b7230f5615e528782a0111a.tar.bz2 scala-e08735380e8cba8f4b7230f5615e528782a0111a.zip |
Track symbol that caused a deprecation warning.
So that we can filter deprecations based on defining package.
Configurable error reporting will support a rule like:
"In compilation unit X, escalate deprecation warnings that
result from accessing members in package P that have been deprecated
since version V. Report an error instead of a warning for those."
TODO: remove deprecationWarning overload that doesn't take a `Symbol`?
(Replace by a default value of `NoSymbol` for the deprecated symbol arg?)
Diffstat (limited to 'src/compiler/scala/tools/nsc/Reporting.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/Reporting.scala | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/Reporting.scala b/src/compiler/scala/tools/nsc/Reporting.scala index a8fd3bec76..1b5a778235 100644 --- a/src/compiler/scala/tools/nsc/Reporting.scala +++ b/src/compiler/scala/tools/nsc/Reporting.scala @@ -61,6 +61,7 @@ trait Reporting extends scala.reflect.internal.Reporting { self: ast.Positions w private val _inlinerWarnings = new ConditionalWarning("inliner", settings.YinlinerWarnings) private val _allConditionalWarnings = List(_deprecationWarnings, _uncheckedWarnings, _featureWarnings, _inlinerWarnings) + // TODO: remove in favor of the overload that takes a Symbol, give that argument a default (NoSymbol) def deprecationWarning(pos: Position, msg: String): Unit = _deprecationWarnings.warn(pos, msg) def uncheckedWarning(pos: Position, msg: String): Unit = _uncheckedWarnings.warn(pos, msg) def featureWarning(pos: Position, msg: String): Unit = _featureWarnings.warn(pos, msg) @@ -73,6 +74,9 @@ trait Reporting extends scala.reflect.internal.Reporting { self: ast.Positions w def allConditionalWarnings = _allConditionalWarnings flatMap (_.warnings) + // 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) + private[this] var reportedFeature = Set[Symbol]() def featureWarning(pos: Position, featureName: String, featureDesc: String, featureTrait: Symbol, construct: => String = "", required: Boolean): Unit = { val req = if (required) "needs to" else "should" |