File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -19,16 +19,12 @@ object PickledQuotes {
1919 import tpd ._
2020
2121 /** Pickle the quote into strings */
22- def pickleQuote (tree : Tree )(implicit ctx : Context ): Tree = {
23- if (ctx.reporter.hasErrors) Literal ( Constant ( " <error> " ))
22+ def pickleQuote (tree : Tree )(implicit ctx : Context ): scala.runtime.quoted. Unpickler . Pickled = {
23+ if (ctx.reporter.hasErrors) Nil
2424 else {
2525 val encapsulated = encapsulateQuote(tree)
2626 val pickled = pickle(encapsulated)
27- TastyString .pickle(pickled).foldRight[Tree ](ref(defn.NilModule )) { (x, acc) =>
28- acc.select(" ::" .toTermName)
29- .appliedToType(defn.StringType )
30- .appliedTo(Literal (Constant (x)))
31- }
27+ TastyString .pickle(pickled)
3228 }
3329 }
3430
Original file line number Diff line number Diff line change @@ -265,12 +265,17 @@ class ReifyQuotes extends MacroTransform {
265265 if (inSplice)
266266 makeHole(body1, splices, quote.tpe)
267267 else {
268+ def liftList (list : List [Tree ], tpe : Type ): Tree = {
269+ list.foldRight[Tree ](ref(defn.NilModule )) { (x, acc) =>
270+ acc.select(" ::" .toTermName).appliedToType(tpe).appliedTo(x)
271+ }
272+ }
268273 val isType = quote.tpe.isRef(defn.QuotedTypeClass )
269274 ref(if (isType) defn.Unpickler_unpickleType else defn.Unpickler_unpickleExpr )
270275 .appliedToType(if (isType) body1.tpe else body1.tpe.widen)
271276 .appliedTo(
272- PickledQuotes .pickleQuote(body1),
273- SeqLiteral (splices, TypeTree ( defn.AnyType ) ))
277+ liftList( PickledQuotes .pickleQuote(body1).map(x => Literal ( Constant (x))), defn. StringType ),
278+ liftList (splices, defn.AnyType ))
274279 }
275280 }.withPos(quote.pos)
276281
You can’t perform that action at this time.
0 commit comments