File tree 2 files changed +28
-1
lines changed
compiler/src/dotty/tools/dotc/transform
2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,19 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
118
118
case Nil => body1
119
119
case tags => tpd.Block (tags, body1).withSpan(body.span)
120
120
121
- super .transformQuotation(body2, quote)
121
+ quote match {
122
+ case Apply (fn1 @ TypeApply (fn0, targs), _) =>
123
+ val heal = new TypeMap {
124
+ def apply (tp : Type ) = tp match {
125
+ case AnnotatedType (parent, annot) => AnnotatedType (mapOver(parent), annot)
126
+ case _ => healTypeOfTerm(fn1.srcPos)(tp)
127
+ }
128
+ }
129
+ val targs1 = targs.map(targ => TypeTree (heal(targ.tpe)))
130
+ cpy.Apply (quote)(cpy.TypeApply (fn1)(fn0, targs1), body2 :: Nil )
131
+ case quote : TypeApply =>
132
+ cpy.TypeApply (quote)(quote.fun, body2 :: Nil )
133
+ }
122
134
}
123
135
124
136
/** Transform splice
Original file line number Diff line number Diff line change
1
+ import scala .quoted ._
2
+ class Foo :
3
+ def foo [T : Type ](using Quotes ): Unit = ' { // level 1
4
+ given Quotes = ???
5
+
6
+ Type .of[T ]
7
+
8
+ ' { ??? : T } // level 2
9
+
10
+ ' { // level 2
11
+ given Quotes = ???
12
+ Type .of[T ]
13
+ ' { ??? : T } // level 3
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments