Skip to content

Commit abbc707

Browse files
committed
Remove dead code and rename addTypedModifiersAnnotations
1 parent d70d184 commit abbc707

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -859,15 +859,11 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
859859
assignType(cpy.Alternative(tree)(trees1), trees1)
860860
}
861861

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)
871867
}
872868

873869
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
876872

877873
def typedValDef(vdef: untpd.ValDef, sym: Symbol)(implicit ctx: Context) = track("typedValDef") {
878874
val ValDef(name, tpt, _) = vdef
879-
addTypedModifiersAnnotations(vdef, sym)
875+
completeAnnotations(vdef, sym)
880876
val tpt1 = typedType(tpt)
881877
val rhs1 = vdef.rhs match {
882878
case rhs @ Ident(nme.WILDCARD) => rhs withType tpt1.tpe
@@ -887,7 +883,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
887883

888884
def typedDefDef(ddef: untpd.DefDef, sym: Symbol)(implicit ctx: Context) = track("typedDefDef") {
889885
val DefDef(name, tparams, vparamss, tpt, _) = ddef
890-
addTypedModifiersAnnotations(ddef, sym)
886+
completeAnnotations(ddef, sym)
891887
val tparams1 = tparams mapconserve (typed(_).asInstanceOf[TypeDef])
892888
val vparamss1 = vparamss nestedMapconserve (typed(_).asInstanceOf[ValDef])
893889
if (sym is Implicit) checkImplicitParamsNotSingletons(vparamss1)
@@ -899,7 +895,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
899895

900896
def typedTypeDef(tdef: untpd.TypeDef, sym: Symbol)(implicit ctx: Context): Tree = track("typedTypeDef") {
901897
val TypeDef(name, rhs) = tdef
902-
addTypedModifiersAnnotations(tdef, sym)
898+
completeAnnotations(tdef, sym)
903899
val _ = typedType(rhs) // unused, typecheck only to remove from typedTree
904900
assignType(cpy.TypeDef(tdef)(name, TypeTree(sym.info), Nil), sym)
905901
}
@@ -916,7 +912,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
916912
result
917913
}
918914

919-
addTypedModifiersAnnotations(cdef, cls)
915+
completeAnnotations(cdef, cls)
920916
val constr1 = typed(constr).asInstanceOf[DefDef]
921917
val parentsWithClass = ensureFirstIsClass(parents mapconserve typedParent, cdef.pos.toSynthetic)
922918
val parents1 = ensureConstrCall(cls, parentsWithClass)(superCtx)

0 commit comments

Comments
 (0)