From d3a71dbd88dd98006a893b35d52ad909c8cd10bb Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 8 Feb 2008 18:28:09 +0000 Subject: fixed missing deprecated warning on types; fixe... fixed missing deprecated warning on types; fixed problem with traits in refinements. --- src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/compiler/scala/tools/nsc/typechecker/RefChecks.scala') diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index bc8a15297e..fa37dd5786 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -684,6 +684,15 @@ abstract class RefChecks extends InfoTransform { result } + /** If symbol is deprecated and is not contained in a depreceated definition, + * issue a deprecated warning + */ + def checkDeprecated(sym: Symbol, pos: Position) { + if (sym.isDeprecated && !currentOwner.ownerChain.exists(_.isDeprecated)) { + unit.deprecationWarning(pos, sym+sym.locationString+" is deprecated") + } + } + /** Check that a deprecated val or def does not override a * concrete, non-deprecated method. If it does, then * deprecation is meaningless. @@ -736,6 +745,7 @@ abstract class RefChecks extends InfoTransform { new TypeTraverser { def traverse(tp: Type): TypeTraverser = tp match { case TypeRef(pre, sym, args) => + checkDeprecated(sym, tree.pos) if (!tp.isHigherKinded) checkBounds(pre, sym.owner, sym.typeParams, args) this case _ => @@ -785,9 +795,7 @@ abstract class RefChecks extends InfoTransform { } case Select(qual, name) => - if (sym.isDeprecated && !currentOwner.ownerChain.exists(_.isDeprecated)) { - unit.deprecationWarning(tree.pos, sym+sym.locationString+" is deprecated") - } + checkDeprecated(sym, tree.pos) if (currentClass != sym.owner && (sym hasFlag LOCAL)) { var o = currentClass var hidden = false -- cgit v1.2.3