Skip to content

Commit ba0b56e

Browse files
committed
Type annotations in context enclosing the annotated definition
Fixes SI-7426, which caused a double definition before.
1 parent edd9ed1 commit ba0b56e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1071,8 +1071,9 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
10711071
def completeAnnotations(mdef: untpd.MemberDef, sym: Symbol)(implicit ctx: Context): Unit = {
10721072
// necessary to force annotation trees to be computed.
10731073
sym.annotations.foreach(_.tree)
1074+
val annotCtx = ctx.outersIterator.dropWhile(_.owner == sym).next
10741075
// necessary in order to mark the typed ahead annotations as definitely typed:
1075-
untpd.modsDeco(mdef).mods.annotations.foreach(typedAnnotation)
1076+
untpd.modsDeco(mdef).mods.annotations.foreach(typedAnnotation(_)(annotCtx))
10761077
}
10771078

10781079
def typedAnnotation(annot: untpd.Tree)(implicit ctx: Context): Tree = track("typedAnnotation") {
File renamed without changes.

0 commit comments

Comments
 (0)