diff options
author | Martin Odersky <odersky@gmail.com> | 2016-08-24 09:50:42 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-08-26 11:13:17 +0200 |
commit | f8970818e3d285b7827a035bffb26c1a4b97319e (patch) | |
tree | 4f5ce7eef7a5ae1bb9de892c4d626eed8757afb0 | |
parent | 86d930bf89aa89e07fdc40ed40431ffea2085090 (diff) | |
download | dotty-f8970818e3d285b7827a035bffb26c1a4b97319e.tar.gz dotty-f8970818e3d285b7827a035bffb26c1a4b97319e.tar.bz2 dotty-f8970818e3d285b7827a035bffb26c1a4b97319e.zip |
Type annotations in context enclosing the annotated definition
Fixes SI-7426, which caused a double definition before.
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 3 | ||||
-rw-r--r-- | tests/pos/t7426.scala (renamed from tests/pending/pos/t7426.scala) | 0 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index c9a2e4b48..f0086b0ab 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -1072,8 +1072,9 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit def completeAnnotations(mdef: untpd.MemberDef, sym: Symbol)(implicit ctx: Context): Unit = { // necessary to force annotation trees to be computed. sym.annotations.foreach(_.tree) + val annotCtx = ctx.outersIterator.dropWhile(_.owner == sym).next // necessary in order to mark the typed ahead annotations as definitely typed: - untpd.modsDeco(mdef).mods.annotations.foreach(typedAnnotation) + untpd.modsDeco(mdef).mods.annotations.foreach(typedAnnotation(_)(annotCtx)) } def typedAnnotation(annot: untpd.Tree)(implicit ctx: Context): Tree = track("typedAnnotation") { diff --git a/tests/pending/pos/t7426.scala b/tests/pos/t7426.scala index 8e42ad181..8e42ad181 100644 --- a/tests/pending/pos/t7426.scala +++ b/tests/pos/t7426.scala |