@@ -859,24 +859,12 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
859
859
assignType(cpy.Alternative (tree)(trees1), trees1)
860
860
}
861
861
862
- def addTypedModifiersAnnotations (mdef : untpd.MemberDef , sym : Symbol )(implicit ctx : Context ): Unit = {
863
- val mods1 = typedModifiers(untpd.modsDeco(mdef).mods, sym)
864
- sym.annotations.foreach(_.tree) // force trees to be computed
865
- }
866
-
867
- def typedModifiers (mods : untpd.Modifiers , sym : Symbol )(implicit ctx : Context ): Modifiers = track(" typedModifiers" ) {
868
- val annotations1 = mods.annotations mapconserve typedAnnotation
869
- if (annotations1 eq mods.annotations) mods.asInstanceOf [Modifiers ]
870
- else Modifiers (mods.flags, mods.privateWithin, annotations1)
871
- }
872
-
873
862
def typedAnnotation (annot : untpd.Tree )(implicit ctx : Context ): Tree = track(" typedAnnotation" ) {
874
863
typed(annot, defn.AnnotationClass .typeRef)
875
864
}
876
865
877
866
def typedValDef (vdef : untpd.ValDef , sym : Symbol )(implicit ctx : Context ) = track(" typedValDef" ) {
878
867
val ValDef (name, tpt, _) = vdef
879
- addTypedModifiersAnnotations(vdef, sym)
880
868
val tpt1 = typedType(tpt)
881
869
val rhs1 = vdef.rhs match {
882
870
case rhs @ Ident (nme.WILDCARD ) => rhs withType tpt1.tpe
@@ -887,7 +875,6 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
887
875
888
876
def typedDefDef (ddef : untpd.DefDef , sym : Symbol )(implicit ctx : Context ) = track(" typedDefDef" ) {
889
877
val DefDef (name, tparams, vparamss, tpt, _) = ddef
890
- addTypedModifiersAnnotations(ddef, sym)
891
878
val tparams1 = tparams mapconserve (typed(_).asInstanceOf [TypeDef ])
892
879
val vparamss1 = vparamss nestedMapconserve (typed(_).asInstanceOf [ValDef ])
893
880
if (sym is Implicit ) checkImplicitParamsNotSingletons(vparamss1)
@@ -899,7 +886,6 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
899
886
900
887
def typedTypeDef (tdef : untpd.TypeDef , sym : Symbol )(implicit ctx : Context ): Tree = track(" typedTypeDef" ) {
901
888
val TypeDef (name, rhs) = tdef
902
- addTypedModifiersAnnotations(tdef, sym)
903
889
val _ = typedType(rhs) // unused, typecheck only to remove from typedTree
904
890
assignType(cpy.TypeDef (tdef)(name, TypeTree (sym.info), Nil ), sym)
905
891
}
@@ -916,7 +902,6 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
916
902
result
917
903
}
918
904
919
- addTypedModifiersAnnotations(cdef, cls)
920
905
val constr1 = typed(constr).asInstanceOf [DefDef ]
921
906
val parentsWithClass = ensureFirstIsClass(parents mapconserve typedParent, cdef.pos.toSynthetic)
922
907
val parents1 = ensureConstrCall(cls, parentsWithClass)(superCtx)
@@ -1023,11 +1008,16 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
1023
1008
case tree : untpd.Bind => typedBind(tree, pt)
1024
1009
case tree : untpd.ValDef =>
1025
1010
if (tree.isEmpty) tpd.EmptyValDef
1026
- else typedValDef(tree, sym)(localContext(tree, sym).setNewScope)
1011
+ else {
1012
+ sym.ensureAnnotationsCompleted()
1013
+ typedValDef(tree, sym)(localContext(tree, sym).setNewScope)
1014
+ }
1027
1015
case tree : untpd.DefDef =>
1016
+ sym.ensureAnnotationsCompleted()
1028
1017
val typer1 = localTyper(sym)
1029
1018
typer1.typedDefDef(tree, sym)(localContext(tree, sym).setTyper(typer1))
1030
1019
case tree : untpd.TypeDef =>
1020
+ sym.ensureAnnotationsCompleted()
1031
1021
if (tree.isClassDef)
1032
1022
typedClassDef(tree, sym.asClass)(localContext(tree, sym).setMode(ctx.mode &~ Mode .InSuperCall ))
1033
1023
else
0 commit comments