@@ -202,27 +202,28 @@ class ReifyQuotes extends MacroTransform {
202202 }
203203
204204 private def pickledQuote (body : Tree , splices : List [Tree ], originalTp : Type , isType : Boolean )(implicit ctx : Context ) = {
205+ def qctx : Tree = {
206+ val qctx = ctx.typer.inferImplicitArg(defn.QuoteContextClass .typeRef, body.span)
207+ if (qctx.tpe.isInstanceOf [SearchFailureType ])
208+ ctx.error(ctx.typer.missingArgMsg(qctx, defn.QuoteContextClass .typeRef, " " ), ctx.source.atSpan(body.span))
209+ qctx
210+ }
205211
206212 def liftedValue [T ](value : T , name : TermName , qctx : Tree ) =
207213 ref(defn.LiftableModule ).select(name).select(" toExpr" .toTermName).appliedTo(Literal (Constant (value))).select(nme.apply).appliedTo(qctx)
208214
209- def pickleAsValue [T ](value : T ) = {
210- val qctx = ctx.typer.inferImplicitArg(defn.QuoteContextClass .typeRef, body.span)
211- if (qctx.tpe.isInstanceOf [SearchFailureType ])
212- ctx.error(ctx.typer.missingArgMsg(qctx, defn.QuoteContextClass .typeRef, " " ), ctx.source.atSpan(body.span))
213- value match {
214- case null => ref(defn.QuotedExprModule ).select(" nullExpr" .toTermName).appliedTo(qctx)
215- case _ : Unit => ref(defn.QuotedExprModule ).select(" unitExpr" .toTermName).appliedTo(qctx)
216- case _ : Boolean => liftedValue(value, " Liftable_Boolean_delegate" .toTermName, qctx)
217- case _ : Byte => liftedValue(value, " Liftable_Byte_delegate" .toTermName, qctx)
218- case _ : Short => liftedValue(value, " Liftable_Short_delegate" .toTermName, qctx)
219- case _ : Int => liftedValue(value, " Liftable_Int_delegate" .toTermName, qctx)
220- case _ : Long => liftedValue(value, " Liftable_Long_delegate" .toTermName, qctx)
221- case _ : Float => liftedValue(value, " Liftable_Float_delegate" .toTermName, qctx)
222- case _ : Double => liftedValue(value, " Liftable_Double_delegate" .toTermName, qctx)
223- case _ : Char => liftedValue(value, " Liftable_Char_delegate" .toTermName, qctx)
224- case _ : String => liftedValue(value, " Liftable_String_delegate" .toTermName, qctx)
225- }
215+ def pickleAsValue [T ](value : T ) = value match {
216+ case null => ref(defn.QuotedExprModule ).select(" nullExpr" .toTermName).appliedTo(qctx)
217+ case _ : Unit => ref(defn.QuotedExprModule ).select(" unitExpr" .toTermName).appliedTo(qctx)
218+ case _ : Boolean => liftedValue(value, " Liftable_Boolean_delegate" .toTermName, qctx)
219+ case _ : Byte => liftedValue(value, " Liftable_Byte_delegate" .toTermName, qctx)
220+ case _ : Short => liftedValue(value, " Liftable_Short_delegate" .toTermName, qctx)
221+ case _ : Int => liftedValue(value, " Liftable_Int_delegate" .toTermName, qctx)
222+ case _ : Long => liftedValue(value, " Liftable_Long_delegate" .toTermName, qctx)
223+ case _ : Float => liftedValue(value, " Liftable_Float_delegate" .toTermName, qctx)
224+ case _ : Double => liftedValue(value, " Liftable_Double_delegate" .toTermName, qctx)
225+ case _ : Char => liftedValue(value, " Liftable_Char_delegate" .toTermName, qctx)
226+ case _ : String => liftedValue(value, " Liftable_String_delegate" .toTermName, qctx)
226227 }
227228
228229 def pickleAsTasty () = {
@@ -239,7 +240,7 @@ class ReifyQuotes extends MacroTransform {
239240 }
240241 if (splices.nonEmpty) pickleAsTasty()
241242 else if (isType) {
242- def tag (tagName : String ) = ref(defn.QuotedTypeModule ).select(tagName.toTermName)
243+ def tag (tagName : String ) = ref(defn.QuotedTypeModule ).select(tagName.toTermName).appliedTo(qctx)
243244 if (body.symbol.isPrimitiveValueClass) tag(s " ${body.symbol.name}Tag " )
244245 else pickleAsTasty()
245246 }
0 commit comments