From 95d7ef40ebde72d9300bf64d4a4fc45b5a0508d7 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Fri, 6 Aug 2010 15:58:47 +0000 Subject: close #2799. --- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 8 ++++++++ test/files/pos/t2799.flags | 1 + test/files/pos/t2799.scala | 1 + 3 files changed, 10 insertions(+) create mode 100644 test/files/pos/t2799.flags create mode 100644 test/files/pos/t2799.scala 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 () -- cgit v1.2.3