@@ -9,6 +9,7 @@ import printing.{Showable, Printer}
9
9
import printing .Texts .Text
10
10
11
11
import scala .annotation .internal .sharable
12
+ import dotty .tools .dotc .ast .TreeTypeMap
12
13
13
14
object Annotations {
14
15
@@ -30,7 +31,7 @@ object Annotations {
30
31
def derivedAnnotation (tree : Tree )(using Context ): Annotation =
31
32
if (tree eq this .tree) this else Annotation (tree)
32
33
33
- /** All arguments to this annotation in a single flat list */
34
+ /** All type and term arguments to this annotation in a single flat list */
34
35
def arguments (using Context ): List [Tree ] = tpd.allArguments(tree)
35
36
36
37
def argument (i : Int )(using Context ): Option [Tree ] = {
@@ -62,10 +63,20 @@ object Annotations {
62
63
if tm.isRange(x) then x
63
64
else
64
65
val tp1 = tm(tree.tpe)
65
- foldOver(if tp1 frozen_ =: = tree.tpe then x else tp1, tree)
66
+ foldOver(if tp1 = = tree.tpe then x else tp1, tree)
66
67
val diff = findDiff(NoType , args)
67
68
if tm.isRange(diff) then EmptyAnnotation
68
- else if diff.exists then derivedAnnotation(tm.mapOver(tree))
69
+ else if diff.exists then
70
+ val ttm = new TreeTypeMap (typeMap = tm):
71
+ /*
72
+ final override def transformDefs[TT <: Tree](trees: List[TT])(using Context): (TreeTypeMap, List[TT]) =
73
+ val syms = localSyms(trees)
74
+ val ttmap = withMappedSyms(syms, mapSymbols(syms, this, mapAlways = true))
75
+ (ttmap, ttmap.transformSub(trees))
76
+ */
77
+ final override def withMappedSyms (syms : List [Symbol ]): TreeTypeMap =
78
+ withMappedSyms(syms, mapSymbols(syms, this , mapAlways = true ))
79
+ derivedAnnotation(ttm.transform(tree))
69
80
else this
70
81
71
82
/** Does this annotation refer to a parameter of `tl`? */
0 commit comments