summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-02-02 18:16:08 +0000
committerMartin Odersky <odersky@gmail.com>2007-02-02 18:16:08 +0000
commit828377d9c0c86471a1c18ba11ff13460400729cf (patch)
tree9b368a14e396e5c781bf6f62dd41edb5f6597b05 /src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
parentffa9da234de5621dfc6d8e760b5368ca68a6520f (diff)
downloadscala-828377d9c0c86471a1c18ba11ff13460400729cf.tar.gz
scala-828377d9c0c86471a1c18ba11ff13460400729cf.tar.bz2
scala-828377d9c0c86471a1c18ba11ff13460400729cf.zip
deprecated checks moved to refchecks.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/RefChecks.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 8209665c15..706f16a5ad 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -555,6 +555,24 @@ abstract class RefChecks extends InfoTransform {
result
}
+ /** Check that a deprecated val or def does not override a
+ * concrete, non-deprecated method. If it does, then
+ * deprecation is meaningless.
+ */
+ def checkDeprecatedOvers() {
+ val symbol = tree.symbol
+ if (symbol.isDeprecated) {
+ val concrOvers =
+ symbol.allOverriddenSymbols.filter(sym =>
+ !sym.isDeprecated && !(sym hasFlag DEFERRED))
+ if(!concrOvers.isEmpty)
+ unit.deprecationWarning(
+ tree.pos,
+ symbol.toString + " overrides concrete, non-deprecated symbol(s):" +
+ concrOvers.map(.fullNameString).mkString(" ", ", ", ""))
+ }
+ }
+
val savedLocalTyper = localTyper
val sym = tree.symbol
var result = tree
@@ -565,9 +583,11 @@ abstract class RefChecks extends InfoTransform {
case DefDef(_, _, _, _, _, _) =>
validateVariance(sym, sym.tpe, CoVariance)
+ checkDeprecatedOvers()
case ValDef(_, _, _, _) =>
- validateVariance(sym, sym.tpe, if (sym.isVariable) NoVariance else CoVariance);
+ validateVariance(sym, sym.tpe, if (sym.isVariable) NoVariance else CoVariance)
+ checkDeprecatedOvers()
case AbsTypeDef(_, _, _, _) =>
validateVariance(sym, sym.info, CoVariance)