diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2016-11-30 22:44:48 +0100 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2016-11-30 23:21:10 +0100 |
commit | 3d0accd7e172303671be23a2be1d827fc9b4dc6e (patch) | |
tree | ce8fabb3c59ff21031b26b0ec96c2474ef94ee44 /compiler | |
parent | a4fea264bd7348f930b47a9f3b08e94693e73564 (diff) | |
download | dotty-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')
-rw-r--r-- | compiler/src/dotty/tools/dotc/transform/TreeTransform.scala | 10 |
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 } |