File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -40,9 +40,19 @@ object Splicer {
4040 case _ =>
4141 val interpreter = new Interpreter (pos, classLoader)
4242 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+ }
4352 // Some parts of the macro are evaluated during the unpickling performed in quotedExprToTree
4453 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
4656 }
4757 catch {
4858 case ex : scala.quoted.QuoteError =>
You can’t perform that action at this time.
0 commit comments