@@ -859,15 +859,11 @@ 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)
862
+ def completeAnnotations (mdef : untpd.MemberDef , sym : Symbol )(implicit ctx : Context ): Unit = {
863
+ // necessary to force annotation trees to be computed.
864
+ sym.annotations.foreach(_.tree)
865
+ // necessary in order to mark the typed ahead annotations as definitiely typed:
866
+ untpd.modsDeco(mdef).mods.annotations.mapconserve(typedAnnotation)
871
867
}
872
868
873
869
def typedAnnotation (annot : untpd.Tree )(implicit ctx : Context ): Tree = track(" typedAnnotation" ) {
@@ -876,7 +872,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
876
872
877
873
def typedValDef (vdef : untpd.ValDef , sym : Symbol )(implicit ctx : Context ) = track(" typedValDef" ) {
878
874
val ValDef (name, tpt, _) = vdef
879
- addTypedModifiersAnnotations (vdef, sym)
875
+ completeAnnotations (vdef, sym)
880
876
val tpt1 = typedType(tpt)
881
877
val rhs1 = vdef.rhs match {
882
878
case rhs @ Ident (nme.WILDCARD ) => rhs withType tpt1.tpe
@@ -887,7 +883,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
887
883
888
884
def typedDefDef (ddef : untpd.DefDef , sym : Symbol )(implicit ctx : Context ) = track(" typedDefDef" ) {
889
885
val DefDef (name, tparams, vparamss, tpt, _) = ddef
890
- addTypedModifiersAnnotations (ddef, sym)
886
+ completeAnnotations (ddef, sym)
891
887
val tparams1 = tparams mapconserve (typed(_).asInstanceOf [TypeDef ])
892
888
val vparamss1 = vparamss nestedMapconserve (typed(_).asInstanceOf [ValDef ])
893
889
if (sym is Implicit ) checkImplicitParamsNotSingletons(vparamss1)
@@ -899,7 +895,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
899
895
900
896
def typedTypeDef (tdef : untpd.TypeDef , sym : Symbol )(implicit ctx : Context ): Tree = track(" typedTypeDef" ) {
901
897
val TypeDef (name, rhs) = tdef
902
- addTypedModifiersAnnotations (tdef, sym)
898
+ completeAnnotations (tdef, sym)
903
899
val _ = typedType(rhs) // unused, typecheck only to remove from typedTree
904
900
assignType(cpy.TypeDef (tdef)(name, TypeTree (sym.info), Nil ), sym)
905
901
}
@@ -916,7 +912,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
916
912
result
917
913
}
918
914
919
- addTypedModifiersAnnotations (cdef, cls)
915
+ completeAnnotations (cdef, cls)
920
916
val constr1 = typed(constr).asInstanceOf [DefDef ]
921
917
val parentsWithClass = ensureFirstIsClass(parents mapconserve typedParent, cdef.pos.toSynthetic)
922
918
val parents1 = ensureConstrCall(cls, parentsWithClass)(superCtx)
0 commit comments