summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala8
-rw-r--r--test/files/pos/t2799.flags1
-rw-r--r--test/files/pos/t2799.scala1
3 files changed, 10 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index ddbba00653..cbdbadc4bf 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1290,6 +1290,14 @@ trait Typers { self: Analyzer =>
"implementation restriction: subclassing Classfile does not\n"+
"make your annotation visible at runtime. If that is what\n"+
"you want, you must write the annotation class in Java.")
+ if (phase.id <= currentRun.typerPhase.id) {
+ for (ann <- clazz.getAnnotation(DeprecatedAttr)) {
+ val m = companionModuleOf(clazz, context)
+ if (m != NoSymbol) {
+ m.moduleClass.addAnnotation(AnnotationInfo(ann.atp, ann.args, List()))
+ }
+ }
+ }
treeCopy.ClassDef(cdef, typedMods, cdef.name, tparams1, impl2)
.setType(NoType)
}
diff --git a/test/files/pos/t2799.flags b/test/files/pos/t2799.flags
new file mode 100644
index 0000000000..d1b831ea87
--- /dev/null
+++ b/test/files/pos/t2799.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/pos/t2799.scala b/test/files/pos/t2799.scala
new file mode 100644
index 0000000000..fe93c0e301
--- /dev/null
+++ b/test/files/pos/t2799.scala
@@ -0,0 +1 @@
+@deprecated("hi mom") case class Bob ()