diff options
author | Martin Odersky <odersky@gmail.com> | 2012-04-11 16:13:09 -0700 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2012-04-11 16:13:09 -0700 |
commit | 699bb5886ec9e73d7c90be1a280e7420d30e6e9b (patch) | |
tree | df0132cf34731c46730fa058c417d89e5986fe74 /src/compiler | |
parent | b448f13d431a1a4e9d23c6acbf4bd15ccb647e3f (diff) | |
download | scala-699bb5886ec9e73d7c90be1a280e7420d30e6e9b.tar.gz scala-699bb5886ec9e73d7c90be1a280e7420d30e6e9b.tar.bz2 scala-699bb5886ec9e73d7c90be1a280e7420d30e6e9b.zip |
new annotation targets for companion classes/objects/factory methods.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/reflect/internal/Definitions.scala | 4 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/compiler/scala/reflect/internal/Definitions.scala b/src/compiler/scala/reflect/internal/Definitions.scala index 6ef6751720..dc8f59b0af 100644 --- a/src/compiler/scala/reflect/internal/Definitions.scala +++ b/src/compiler/scala/reflect/internal/Definitions.scala @@ -905,7 +905,9 @@ trait Definitions extends reflect.api.StandardDefinitions { lazy val GetterTargetClass = getMetaAnnotation("getter") lazy val ParamTargetClass = getMetaAnnotation("param") lazy val SetterTargetClass = getMetaAnnotation("setter") - // TODO: module, moduleClass? package, packageObject? + lazy val ClassTargetClass = getMetaAnnotation("companionClass") + lazy val ObjectTargetClass = getMetaAnnotation("companionObject") + lazy val MethodTargetClass = getMetaAnnotation("companionMethod") // TODO: module, moduleClass? package, packageObject? private def getMetaAnnotation(name: String) = getRequiredClass("scala.annotation.meta." + name) def isMetaAnnotation(sym: Symbol): Boolean = metaAnnotations(sym) || ( diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala index ff0bdf7580..4a05b28867 100644 --- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala @@ -832,7 +832,7 @@ trait ContextErrors { implicit val context0 = context object SymValidateErrors extends Enumeration { - val ImplicitConstr, ImplicitNotTerm, ImplicitTopObject, + val ImplicitConstr, ImplicitNotTermOrClass, ImplicitAtToplevel, OverrideClass, SealedNonClass, AbstractNonClass, OverrideConstr, AbstractOverride, LazyAndEarlyInit, ByNameParameter, AbstractVar = Value @@ -898,10 +898,10 @@ trait ContextErrors { case ImplicitConstr => "`implicit' modifier not allowed for constructors" - case ImplicitNotTerm => - "`implicit' modifier can be used only for values, variables and methods" + case ImplicitNotTermOrClass => + "`implicit' modifier can be used only for values, variables, methods and classes" - case ImplicitTopObject => + case ImplicitAtToplevel => "`implicit' modifier cannot be used for top-level objects" case OverrideClass => |