@@ -738,8 +738,9 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
738
738
assignType(cpy.Alternative (tree, trees1), trees1)
739
739
}
740
740
741
- def typedModifiers (mods : untpd.Modifiers )(implicit ctx : Context ): Modifiers = track(" typedModifiers" ) {
741
+ def typedModifiers (mods : untpd.Modifiers , sym : Symbol )(implicit ctx : Context ): Modifiers = track(" typedModifiers" ) {
742
742
val annotations1 = mods.annotations mapconserve typedAnnotation
743
+ for (tree <- annotations1) sym.addAnnotation(Annotation (tree))
743
744
if (annotations1 eq mods.annotations) mods.asInstanceOf [Modifiers ]
744
745
else Modifiers (mods.flags, mods.privateWithin, annotations1)
745
746
}
@@ -750,7 +751,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
750
751
751
752
def typedValDef (vdef : untpd.ValDef , sym : Symbol )(implicit ctx : Context ) = track(" typedValDef" ) {
752
753
val ValDef (mods, name, tpt, rhs) = vdef
753
- val mods1 = typedModifiers(mods)
754
+ val mods1 = typedModifiers(mods, sym )
754
755
val tpt1 = typedType(tpt)
755
756
if ((sym is Implicit ) && sym.owner.isType) checkImplicitTptNonEmpty(vdef)
756
757
val rhs1 = rhs match {
@@ -762,7 +763,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
762
763
763
764
def typedDefDef (ddef : untpd.DefDef , sym : Symbol )(implicit ctx : Context ) = track(" typedDefDef" ) {
764
765
val DefDef (mods, name, tparams, vparamss, tpt, rhs) = ddef
765
- val mods1 = typedModifiers(mods)
766
+ val mods1 = typedModifiers(mods, sym )
766
767
val tparams1 = tparams mapconserve (typed(_).asInstanceOf [TypeDef ])
767
768
val vparamss1 = vparamss nestedMapconserve (typed(_).asInstanceOf [ValDef ])
768
769
if (sym is Implicit ) {
@@ -777,7 +778,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
777
778
778
779
def typedTypeDef (tdef : untpd.TypeDef , sym : Symbol )(implicit ctx : Context ): Tree = track(" typedTypeDef" ) {
779
780
val TypeDef (mods, name, rhs) = tdef
780
- val mods1 = typedModifiers(mods)
781
+ val mods1 = typedModifiers(mods, sym )
781
782
val _ = typedType(rhs) // unused, typecheck only to remove from typedTree
782
783
assignType(cpy.TypeDef (tdef, mods1, name, TypeTree (sym.info)), sym)
783
784
}
@@ -804,7 +805,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
804
805
}
805
806
806
807
val TypeDef (mods, name, impl @ Template (constr, parents, self, body)) = cdef
807
- val mods1 = typedModifiers(mods)
808
+ val mods1 = typedModifiers(mods, cls )
808
809
val constr1 = typed(constr).asInstanceOf [DefDef ]
809
810
val parents1 = ensureConstrCall(ensureFirstIsClass(
810
811
parents mapconserve typedParent, cdef.pos.toSynthetic))
0 commit comments