diff options
author | Martin Odersky <odersky@gmail.com> | 2015-11-07 14:22:36 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-11-09 15:45:38 +0100 |
commit | 23be0fddeec6d6c280f277cd06a7f576dc8b38a6 (patch) | |
tree | a638b960b4d0212bcc923b8424bc765dc9d0d825 | |
parent | 687dec19304e87536f07fb4e65338121ed1b10c7 (diff) | |
download | dotty-23be0fddeec6d6c280f277cd06a7f576dc8b38a6.tar.gz dotty-23be0fddeec6d6c280f277cd06a7f576dc8b38a6.tar.bz2 dotty-23be0fddeec6d6c280f277cd06a7f576dc8b38a6.zip |
Standardize naming and definition order of annotation classes
-rw-r--r-- | src/dotty/tools/dotc/core/Definitions.scala | 46 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/ExtensionMethods.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/TailRec.scala | 6 |
3 files changed, 28 insertions, 28 deletions
diff --git a/src/dotty/tools/dotc/core/Definitions.scala b/src/dotty/tools/dotc/core/Definitions.scala index 384ae47a8..c419806de 100644 --- a/src/dotty/tools/dotc/core/Definitions.scala +++ b/src/dotty/tools/dotc/core/Definitions.scala @@ -398,54 +398,54 @@ class Definitions { lazy val NonLocalReturnControlTypeRef = ctx.requiredClassRef("scala.runtime.NonLocalReturnControl") // Annotation base classes - lazy val AnnotationTypeRef = ctx.requiredClassRef("scala.annotation.Annotation") // ### AnnotationTypeRef --> AnnotRef? + lazy val AnnotationTypeRef = ctx.requiredClassRef("scala.annotation.Annotation") def AnnotationClass = AnnotationTypeRef.symbol.asClass lazy val ClassfileAnnotationTypeRef = ctx.requiredClassRef("scala.annotation.ClassfileAnnotation") def ClassfileAnnotationClass = ClassfileAnnotationTypeRef.symbol.asClass lazy val StaticAnnotationTypeRef = ctx.requiredClassRef("scala.annotation.StaticAnnotation") def StaticAnnotationClass = StaticAnnotationTypeRef.symbol.asClass - lazy val TailrecAnnotationTypeRef = ctx.requiredClassRef("scala.annotation.tailrec") - def TailrecAnnotationClass = TailrecAnnotationTypeRef.symbol.asClass - lazy val RemoteAnnotRef = ctx.requiredClassRef("scala.remote") - def RemoteAnnot = RemoteAnnotRef.symbol.asClass - lazy val SerialVersionUIDAnnotRef = ctx.requiredClassRef("scala.SerialVersionUID") - def SerialVersionUIDAnnot = SerialVersionUIDAnnotRef.symbol.asClass - lazy val TransientAnnotRef = ctx.requiredClassRef("scala.transient") - def TransientAnnot = TransientAnnotRef.symbol.asClass - lazy val NativeAnnotRef = ctx.requiredClassRef("scala.native") - def NativeAnnot = NativeAnnotRef.symbol.asClass - lazy val ScalaStrictFPAnnotRef = ctx.requiredClassRef("scala.annotation.strictfp") - def ScalaStrictFPAnnot = ScalaStrictFPAnnotRef.symbol.asClass // Annotation classes lazy val AliasAnnotRef = ctx.requiredClassRef("dotty.annotation.internal.Alias") def AliasAnnot = AliasAnnotRef.symbol.asClass + lazy val AnnotationDefaultAnnotRef = ctx.requiredClassRef("dotty.annotation.internal.AnnotationDefault") + def AnnotationDefaultAnnot = AnnotationDefaultAnnotRef.symbol.asClass lazy val ChildAnnotRef = ctx.requiredClassRef("dotty.annotation.internal.Child") def ChildAnnot = ChildAnnotRef.symbol.asClass - lazy val RepeatedAnnotRef = ctx.requiredClassRef("dotty.annotation.internal.Repeated") - def RepeatedAnnot = RepeatedAnnotRef.symbol.asClass - lazy val InvariantBetweenAnnotRef = ctx.requiredClassRef("dotty.annotation.internal.InvariantBetween") - def InvariantBetweenAnnot = InvariantBetweenAnnotRef.symbol.asClass lazy val CovariantBetweenAnnotRef = ctx.requiredClassRef("dotty.annotation.internal.CovariantBetween") def CovariantBetweenAnnot = CovariantBetweenAnnotRef.symbol.asClass lazy val ContravariantBetweenAnnotRef = ctx.requiredClassRef("dotty.annotation.internal.ContravariantBetween") def ContravariantBetweenAnnot = ContravariantBetweenAnnotRef.symbol.asClass + lazy val DeprecatedAnnotRef = ctx.requiredClassRef("scala.deprecated") + def DeprecatedAnnot = DeprecatedAnnotRef.symbol.asClass + lazy val InvariantBetweenAnnotRef = ctx.requiredClassRef("dotty.annotation.internal.InvariantBetween") + def InvariantBetweenAnnot = InvariantBetweenAnnotRef.symbol.asClass + lazy val MigrationAnnotRef = ctx.requiredClassRef("scala.annotation.migration") + def MigrationAnnot = MigrationAnnotRef.symbol.asClass + lazy val NativeAnnotRef = ctx.requiredClassRef("scala.native") + def NativeAnnot = NativeAnnotRef.symbol.asClass + lazy val RemoteAnnotRef = ctx.requiredClassRef("scala.remote") + def RemoteAnnot = RemoteAnnotRef.symbol.asClass + lazy val RepeatedAnnotRef = ctx.requiredClassRef("dotty.annotation.internal.Repeated") + def RepeatedAnnot = RepeatedAnnotRef.symbol.asClass lazy val ScalaSignatureAnnotRef = ctx.requiredClassRef("scala.reflect.ScalaSignature") def ScalaSignatureAnnot = ScalaSignatureAnnotRef.symbol.asClass lazy val ScalaLongSignatureAnnotRef = ctx.requiredClassRef("scala.reflect.ScalaLongSignature") def ScalaLongSignatureAnnot = ScalaLongSignatureAnnotRef.symbol.asClass + lazy val ScalaStrictFPAnnotRef = ctx.requiredClassRef("scala.annotation.strictfp") + def ScalaStrictFPAnnot = ScalaStrictFPAnnotRef.symbol.asClass + lazy val SerialVersionUIDAnnotRef = ctx.requiredClassRef("scala.SerialVersionUID") + def SerialVersionUIDAnnot = SerialVersionUIDAnnotRef.symbol.asClass lazy val TASTYSignatureAnnotRef = ctx.requiredClassRef("scala.annotation.internal.TASTYSignature") def TASTYSignatureAnnot = TASTYSignatureAnnotRef.symbol.asClass lazy val TASTYLongSignatureAnnotRef = ctx.requiredClassRef("scala.annotation.internal.TASTYLongSignature") def TASTYLongSignatureAnnot = TASTYLongSignatureAnnotRef.symbol.asClass - lazy val DeprecatedAnnotRef = ctx.requiredClassRef("scala.deprecated") - def DeprecatedAnnot = DeprecatedAnnotRef.symbol.asClass - lazy val MigrationAnnotRef = ctx.requiredClassRef("scala.annotation.migration") - def MigrationAnnot = MigrationAnnotRef.symbol.asClass - lazy val AnnotationDefaultAnnotRef = ctx.requiredClassRef("dotty.annotation.internal.AnnotationDefault") - def AnnotationDefaultAnnot = AnnotationDefaultAnnotRef.symbol.asClass + lazy val TailrecAnnotRef = ctx.requiredClassRef("scala.annotation.tailrec") + def TailrecAnnot = TailrecAnnotRef.symbol.asClass lazy val ThrowsAnnotRef = ctx.requiredClassRef("scala.throws") def ThrowsAnnot = ThrowsAnnotRef.symbol.asClass + lazy val TransientAnnotRef = ctx.requiredClassRef("scala.transient") + def TransientAnnot = TransientAnnotRef.symbol.asClass lazy val UncheckedAnnotRef = ctx.requiredClassRef("scala.unchecked") def UncheckedAnnot = UncheckedAnnotRef.symbol.asClass lazy val UncheckedStableAnnotRef = ctx.requiredClassRef("scala.annotation.unchecked.uncheckedStable") diff --git a/src/dotty/tools/dotc/transform/ExtensionMethods.scala b/src/dotty/tools/dotc/transform/ExtensionMethods.scala index 087e15c71..02c01bca8 100644 --- a/src/dotty/tools/dotc/transform/ExtensionMethods.scala +++ b/src/dotty/tools/dotc/transform/ExtensionMethods.scala @@ -98,9 +98,9 @@ class ExtensionMethods extends MiniPhaseTransform with DenotTransformer with Ful moduleClassSym } case ref: SymDenotation - if isMethodWithExtension(ref) && ref.hasAnnotation(defn.TailrecAnnotationClass) => + if isMethodWithExtension(ref) && ref.hasAnnotation(defn.TailrecAnnot) => val ref1 = ref.copySymDenotation() - ref1.removeAnnotation(defn.TailrecAnnotationClass) + ref1.removeAnnotation(defn.TailrecAnnot) ref1 case _ => ref diff --git a/src/dotty/tools/dotc/transform/TailRec.scala b/src/dotty/tools/dotc/transform/TailRec.scala index 441d3ef2b..ddcdb8e4f 100644 --- a/src/dotty/tools/dotc/transform/TailRec.scala +++ b/src/dotty/tools/dotc/transform/TailRec.scala @@ -85,7 +85,7 @@ class TailRec extends MiniPhaseTransform with DenotTransformer with FullParamete tree match { case dd@DefDef(name, tparams, vparamss0, tpt, _) if (sym.isEffectivelyFinal) && !((sym is Flags.Accessor) || (dd.rhs eq EmptyTree) || (sym is Flags.Label)) => - val mandatory = sym.hasAnnotation(defn.TailrecAnnotationClass) + val mandatory = sym.hasAnnotation(defn.TailrecAnnot) atGroupEnd { implicit ctx: Context => cpy.DefDef(dd)(rhs = { @@ -121,10 +121,10 @@ class TailRec extends MiniPhaseTransform with DenotTransformer with FullParamete } }) } - case d: DefDef if d.symbol.hasAnnotation(defn.TailrecAnnotationClass) => + case d: DefDef if d.symbol.hasAnnotation(defn.TailrecAnnot) => ctx.error("TailRec optimisation not applicable, method is neither private nor final so can be overridden", d.pos) d - case d if d.symbol.hasAnnotation(defn.TailrecAnnotationClass) => + case d if d.symbol.hasAnnotation(defn.TailrecAnnot) => ctx.error("TailRec optimisation not applicable, not a method", d.pos) d case _ => tree |