@@ -59,8 +59,12 @@ class PCPCheckAndHeal extends TreeMapWithStages {
59
59
checkAnnotations(tree)
60
60
super .transform(tree)
61
61
else tree match {
62
-
63
- case _ : TypeTree | _ : RefTree if tree.isType =>
62
+ case _ : TypeTree =>
63
+ val tp1 = transformTypeAnnotationSplices(tree.tpe)
64
+ val healedType = healType(tree.srcPos)(tp1)
65
+ if healedType == tree.tpe then tree
66
+ else TypeTree (healedType).withSpan(tree.span)
67
+ case _ : RefTree if tree.isType =>
64
68
val healedType = healType(tree.srcPos)(tree.tpe)
65
69
if healedType == tree.tpe then tree
66
70
else TypeTree (healedType).withSpan(tree.span)
@@ -163,6 +167,15 @@ class PCPCheckAndHeal extends TreeMapWithStages {
163
167
ref(tagRef).withSpan(splice.span)
164
168
}
165
169
170
+ def transformTypeAnnotationSplices (tp : Type )(using Context ) = new TypeMap {
171
+ def apply (tp : Type ): Type = tp match
172
+ case tp : AnnotatedType =>
173
+ val newAnnotTree = transform(tp.annot.tree)
174
+ derivedAnnotatedType(tp, apply(tp.parent), tp.annot.derivedAnnotation(newAnnotTree))
175
+ case _ =>
176
+ mapOver(tp)
177
+ }.apply(tp)
178
+
166
179
/** Check that annotations do not contain quotes and and that splices are valid */
167
180
private def checkAnnotations (tree : Tree )(using Context ): Unit =
168
181
tree match
@@ -198,8 +211,7 @@ class PCPCheckAndHeal extends TreeMapWithStages {
198
211
case tp @ TermRef (NoPrefix , _) if ! tp.symbol.isStatic && level > levelOf(tp.symbol) =>
199
212
levelError(tp.symbol, tp, pos)
200
213
case tp : AnnotatedType =>
201
- val newAnnotTree = transform(tp.annot.tree)
202
- derivedAnnotatedType(tp, apply(tp.parent), tp.annot.derivedAnnotation(newAnnotTree))
214
+ derivedAnnotatedType(tp, apply(tp.parent), tp.annot)
203
215
case _ =>
204
216
mapOver(tp)
205
217
0 commit comments