aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/transform
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2016-11-30 22:44:48 +0100
committerGuillaume Martres <smarter@ubuntu.com>2016-11-30 23:21:10 +0100
commit3d0accd7e172303671be23a2be1d827fc9b4dc6e (patch)
treece8fabb3c59ff21031b26b0ec96c2474ef94ee44 /compiler/src/dotty/tools/dotc/transform
parenta4fea264bd7348f930b47a9f3b08e94693e73564 (diff)
downloaddotty-3d0accd7e172303671be23a2be1d827fc9b4dc6e.tar.gz
dotty-3d0accd7e172303671be23a2be1d827fc9b4dc6e.tar.bz2
dotty-3d0accd7e172303671be23a2be1d827fc9b4dc6e.zip
Fix transformation of inline body annotations
Previously we replaced them by ConcreteAnnotation so they became regular annotations and could be emitted in some cases. They need to keep being BodyAnnotation.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/transform')
-rw-r--r--compiler/src/dotty/tools/dotc/transform/TreeTransform.scala10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/transform/TreeTransform.scala b/compiler/src/dotty/tools/dotc/transform/TreeTransform.scala
index 5385ca720..b0bd40578 100644
--- a/compiler/src/dotty/tools/dotc/transform/TreeTransform.scala
+++ b/compiler/src/dotty/tools/dotc/transform/TreeTransform.scala
@@ -3,7 +3,6 @@ package dotc
package transform
import dotty.tools.dotc.ast.tpd
-import dotty.tools.dotc.core.Annotations.ConcreteAnnotation
import dotty.tools.dotc.core.Contexts.Context
import dotty.tools.dotc.core.DenotTransformers.{InfoTransformer, DenotTransformer}
import dotty.tools.dotc.core.Denotations.SingleDenotation
@@ -181,10 +180,15 @@ object TreeTransforms {
abstract override def transform(ref: SingleDenotation)(implicit ctx: Context): SingleDenotation =
super.transform(ref) match {
case ref1: SymDenotation if ref1.symbol.isDefinedInCurrentRun =>
- val annotTrees = ref1.annotations.map(_.tree)
+ val annots = ref1.annotations
+ val annotTrees = annots.map(_.tree)
val annotTrees1 = annotTrees.mapConserve(annotationTransformer.macroTransform)
if (annotTrees eq annotTrees1) ref1
- else ref1.copySymDenotation(annotations = annotTrees1.map(new ConcreteAnnotation(_)))
+ else {
+ val derivedAnnots = (annots, annotTrees1).zipped.map((annot, annotTree1) =>
+ annot.derivedAnnotation(annotTree1))
+ ref1.copySymDenotation(annotations = derivedAnnots)
+ }
case ref1 =>
ref1
}