Skip to content

Commit a068498

Browse files
committed
Replace addAnnotation(annotation) by addAnnotation(Annotation(annotation))
as asked in https://github.com/lampepfl/dotty/pull/1155/files#r55355664
1 parent ead3094 commit a068498

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/dotty/tools/dotc/core/Annotations.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ object Annotations {
4747

4848
def apply(tree: Tree) = ConcreteAnnotation(tree)
4949

50+
def apply(cls: ClassSymbol)(implicit ctx: Context): Annotation =
51+
apply(cls, Nil)
52+
5053
def apply(cls: ClassSymbol, arg: Tree)(implicit ctx: Context): Annotation =
5154
apply(cls, arg :: Nil)
5255

src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,6 @@ object SymDenotations {
285285
final def addAnnotation(annot: Annotation): Unit =
286286
annotations = annot :: myAnnotations
287287

288-
/** Add given annotation to the annotations of this denotation */
289-
final def addAnnotation(annot: ClassSymbol)(implicit ctx: Context): Unit =
290-
addAnnotation(ConcreteAnnotation(tpd.ref(annot)))
291-
292288
/** Remove annotation with given class from this denotation */
293289
final def removeAnnotation(cls: Symbol)(implicit ctx: Context): Unit =
294290
annotations = myAnnotations.filterNot(_ matches cls)

src/dotty/tools/dotc/transform/LazyVals.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import dotty.tools.dotc.core.Annotations.Annotation
45
import dotty.tools.dotc.core.Phases.NeedsCompanions
56
import dotty.tools.dotc.typer.Mode
67

@@ -91,7 +92,7 @@ class LazyVals extends MiniPhaseTransform with IdentityDenotTransformer with Nee
9192
appendOffsetDefs.get(cls) match {
9293
case None => template
9394
case Some(data) =>
94-
data.defs.foreach(_.symbol.addAnnotation(defn.ScalaStaticAnnot))
95+
data.defs.foreach(_.symbol.addAnnotation(Annotation(defn.ScalaStaticAnnot)))
9596
cpy.Template(template)(body = addInFront(data.defs, template.body))
9697
}
9798

@@ -358,7 +359,7 @@ class LazyVals extends MiniPhaseTransform with IdentityDenotTransformer with Nee
358359
.symbol.asTerm
359360
} else { // need to create a new flag
360361
offsetSymbol = ctx.newSymbol(companion.moduleClass, (StdNames.nme.LAZY_FIELD_OFFSET + id.toString).toTermName, Flags.Synthetic, defn.LongType).enteredAfter(this)
361-
offsetSymbol.addAnnotation(defn.ScalaStaticAnnot)
362+
offsetSymbol.addAnnotation(Annotation(defn.ScalaStaticAnnot))
362363
val flagName = (StdNames.nme.BITMAP_PREFIX + id.toString).toTermName
363364
val flagSymbol = ctx.newSymbol(claz, flagName, containerFlags, defn.LongType).enteredAfter(this)
364365
flag = ValDef(flagSymbol, Literal(Constants.Constant(0L)))
@@ -368,7 +369,7 @@ class LazyVals extends MiniPhaseTransform with IdentityDenotTransformer with Nee
368369

369370
case None =>
370371
offsetSymbol = ctx.newSymbol(companion.moduleClass, (StdNames.nme.LAZY_FIELD_OFFSET + "0").toTermName, Flags.Synthetic, defn.LongType).enteredAfter(this)
371-
offsetSymbol.addAnnotation(defn.ScalaStaticAnnot)
372+
offsetSymbol.addAnnotation(Annotation(defn.ScalaStaticAnnot))
372373
val flagName = (StdNames.nme.BITMAP_PREFIX + "0").toTermName
373374
val flagSymbol = ctx.newSymbol(claz, flagName, containerFlags, defn.LongType).enteredAfter(this)
374375
flag = ValDef(flagSymbol, Literal(Constants.Constant(0L)))

0 commit comments

Comments
 (0)