File tree Expand file tree Collapse file tree 4 files changed +40
-0
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 4 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,11 @@ class CrossVersionChecks extends MiniPhase:
3737 for annot <- sym.annotations if annot.symbol.isExperimental do
3838 Feature .checkExperimentalDef(annot.symbol, annot.tree)
3939
40+ private def checkDeprecatedAnnots (sym : Symbol )(using Context ): Unit =
41+ if sym.exists then
42+ for annot <- sym.annotations if annot.symbol.isDeprecated do
43+ checkDeprecatedRef(annot.symbol, annot.tree.srcPos)
44+
4045 /** If @migration is present (indicating that the symbol has changed semantics between versions),
4146 * emit a warning.
4247 */
@@ -85,16 +90,19 @@ class CrossVersionChecks extends MiniPhase:
8590 override def transformValDef (tree : ValDef )(using Context ): ValDef =
8691 checkDeprecatedOvers(tree)
8792 checkExperimentalAnnots(tree.symbol)
93+ checkDeprecatedAnnots(tree.symbol)
8894 tree
8995
9096 override def transformDefDef (tree : DefDef )(using Context ): DefDef =
9197 checkDeprecatedOvers(tree)
9298 checkExperimentalAnnots(tree.symbol)
99+ checkDeprecatedAnnots(tree.symbol)
93100 tree
94101
95102 override def transformTypeDef (tree : TypeDef )(using Context ): TypeDef =
96103 // TODO do we need to check checkDeprecatedOvers(tree)?
97104 checkExperimentalAnnots(tree.symbol)
105+ checkDeprecatedAnnots(tree.symbol)
98106 tree
99107
100108 override def transformTemplate (tree : tpd.Template )(using Context ): tpd.Tree =
Original file line number Diff line number Diff line change 1+
2+ -- Deprecation Warning: tests/warn/i23905/Test_2.scala:3:0 -------------------------------------------------------------
3+ 3 |@DeprecatedAnnotation // warn
4+ |^^^^^^^^^^^^^^^^^^^^^
5+ |class DeprecatedAnnotation is deprecated
6+ -- Deprecation Warning: tests/warn/i23905/Test_2.scala:6:0 -------------------------------------------------------------
7+ 6 |@DeprecatedAnnotation // warn
8+ |^^^^^^^^^^^^^^^^^^^^^
9+ |class DeprecatedAnnotation is deprecated
10+ -- Deprecation Warning: tests/warn/i23905/Test_2.scala:9:0 -------------------------------------------------------------
11+ 9 |@DeprecatedAnnotation // warn
12+ |^^^^^^^^^^^^^^^^^^^^^
13+ |class DeprecatedAnnotation is deprecated
14+ -- Deprecation Warning: tests/warn/i23905/Test_2.scala:12:0 ------------------------------------------------------------
15+ 12 |@DeprecatedAnnotation // warn
16+ |^^^^^^^^^^^^^^^^^^^^^
17+ |class DeprecatedAnnotation is deprecated
Original file line number Diff line number Diff line change 1+ @ deprecated
2+ class DeprecatedAnnotation extends annotation.StaticAnnotation
Original file line number Diff line number Diff line change 1+ //> using options -deprecation
2+
3+ @ DeprecatedAnnotation // warn
4+ object Test1
5+
6+ @ DeprecatedAnnotation // warn
7+ class Test2
8+
9+ @ DeprecatedAnnotation // warn
10+ def Test3 = ???
11+
12+ @ DeprecatedAnnotation // warn
13+ val Test4 = ???
You can’t perform that action at this time.
0 commit comments