File tree 1 file changed +11
-1
lines changed
compiler/src/dotty/tools/dotc/transform
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -40,9 +40,19 @@ object Splicer {
40
40
case _ =>
41
41
val interpreter = new Interpreter (pos, classLoader)
42
42
try {
43
+ // TODO try to apply position directly in the TASTy reflect constructors
44
+ val positioner = new TreeMap () {
45
+ override def transform (tree : tpd.Tree )(implicit ctx : Context ): tpd.Tree = {
46
+ val tree1 =
47
+ if (tree.span.exists) tree
48
+ else tree.withSpan(pos.span) // TODO change the source if needed: tree.withPos(pos)
49
+ super .transform(tree1)
50
+ }
51
+ }
43
52
// Some parts of the macro are evaluated during the unpickling performed in quotedExprToTree
44
53
val interpretedExpr = interpreter.interpret[scala.quoted.Expr [Any ]](tree)
45
- interpretedExpr.fold(tree)(x => PickledQuotes .quotedExprToTree(x))
54
+ val interpretedTree = interpretedExpr.fold(tree)(x => positioner.transform(PickledQuotes .quotedExprToTree(x)))
55
+ interpretedTree
46
56
}
47
57
catch {
48
58
case ex : scala.quoted.QuoteError =>
You can’t perform that action at this time.
0 commit comments