@@ -745,10 +745,11 @@ class Namer { typer: Typer =>
745
745
while (c.owner != target) c = c.outer
746
746
c
747
747
}
748
+
748
749
for (annotTree <- untpd.modsDeco(stat).mods.annotations) {
749
- val cls = typedAheadAnnotation (annotTree)(annotCtx)
750
+ val cls = typedAheadAnnotationClass (annotTree)(annotCtx)
750
751
if (sym.unforcedAnnotation(cls).isEmpty) {
751
- val ann = Annotation .deferred(cls, implicit ctx => typedAnnotation (annotTree))
752
+ val ann = Annotation .deferred(cls, implicit ctx => typedAheadAnnotation (annotTree))
752
753
sym.addAnnotation(ann)
753
754
if (cls == defn.InlineAnnot && sym.is(Method , butNot = Accessor ))
754
755
sym.setFlag(Inline )
@@ -1012,10 +1013,13 @@ class Namer { typer: Typer =>
1012
1013
def typedAheadExpr (tree : Tree , pt : Type = WildcardType )(implicit ctx : Context ): tpd.Tree =
1013
1014
typedAheadImpl(tree, typer.typed(_, pt)(ctx retractMode Mode .PatternOrTypeBits ))
1014
1015
1015
- def typedAheadAnnotation (tree : Tree )(implicit ctx : Context ): Symbol = tree match {
1016
- case Apply (fn, _) => typedAheadAnnotation(fn)
1017
- case TypeApply (fn, _) => typedAheadAnnotation(fn)
1018
- case Select (qual, nme.CONSTRUCTOR ) => typedAheadAnnotation(qual)
1016
+ def typedAheadAnnotation (tree : Tree )(implicit ctx : Context ): tpd.Tree =
1017
+ typedAheadExpr(tree, defn.AnnotationType )
1018
+
1019
+ def typedAheadAnnotationClass (tree : Tree )(implicit ctx : Context ): Symbol = tree match {
1020
+ case Apply (fn, _) => typedAheadAnnotationClass(fn)
1021
+ case TypeApply (fn, _) => typedAheadAnnotationClass(fn)
1022
+ case Select (qual, nme.CONSTRUCTOR ) => typedAheadAnnotationClass(qual)
1019
1023
case New (tpt) => typedAheadType(tpt).tpe.classSymbol
1020
1024
}
1021
1025
0 commit comments