File tree 3 files changed +19
-10
lines changed
compiler/src/dotty/tools/dotc/transform
library/src-bootstrapped/scala/quoted
3 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -209,7 +209,9 @@ class ReifyQuotes extends MacroTransform {
209
209
}
210
210
211
211
def liftedValue [T ](value : T , name : TermName ) =
212
- ref(defn.LiftableModule ).select(name).select(" toExpr" .toTermName).appliedTo(Literal (Constant (value)))
212
+ ref(defn.LiftableModule )
213
+ .select(name).appliedToType(originalTp)
214
+ .select(" toExpr" .toTermName).appliedTo(Literal (Constant (value)))
213
215
214
216
def pickleAsValue [T ](value : T ) = {
215
217
value match {
Original file line number Diff line number Diff line change @@ -19,15 +19,15 @@ trait Liftable[T] {
19
19
*/
20
20
object Liftable {
21
21
22
- given Liftable_Boolean_delegate as Liftable [Boolean ] = new PrimitiveLiftable
23
- given Liftable_Byte_delegate as Liftable [Byte ] = new PrimitiveLiftable
24
- given Liftable_Short_delegate as Liftable [Short ] = new PrimitiveLiftable
25
- given Liftable_Int_delegate as Liftable [Int ] = new PrimitiveLiftable
26
- given Liftable_Long_delegate as Liftable [Long ] = new PrimitiveLiftable
27
- given Liftable_Float_delegate as Liftable [Float ] = new PrimitiveLiftable
28
- given Liftable_Double_delegate as Liftable [Double ] = new PrimitiveLiftable
29
- given Liftable_Char_delegate as Liftable [Char ] = new PrimitiveLiftable
30
- given Liftable_String_delegate as Liftable [String ] = new PrimitiveLiftable
22
+ given Liftable_Boolean_delegate [ T <: Boolean ] as Liftable [T ] = new PrimitiveLiftable
23
+ given Liftable_Byte_delegate [ T <: Byte ] as Liftable [T ] = new PrimitiveLiftable
24
+ given Liftable_Short_delegate [ T <: Short ] as Liftable [T ] = new PrimitiveLiftable
25
+ given Liftable_Int_delegate [ T <: Int ] as Liftable [T ] = new PrimitiveLiftable
26
+ given Liftable_Long_delegate [ T <: Long ] as Liftable [T ] = new PrimitiveLiftable
27
+ given Liftable_Float_delegate [ T <: Float ] as Liftable [T ] = new PrimitiveLiftable
28
+ given Liftable_Double_delegate [ T <: Double ] as Liftable [T ] = new PrimitiveLiftable
29
+ given Liftable_Char_delegate [ T <: Char ] as Liftable [T ] = new PrimitiveLiftable
30
+ given Liftable_String_delegate [ T <: String ] as Liftable [T ] = new PrimitiveLiftable
31
31
32
32
private class PrimitiveLiftable [T <: Unit | Null | Int | Boolean | Byte | Short | Int | Long | Float | Double | Char | String ] extends Liftable [T ] {
33
33
/** Lift a primitive value `n` into `'{ n }` */
Original file line number Diff line number Diff line change
1
+ import scala .quoted ._
2
+
3
+ inline def mcr : Any = $ {mcrImpl}
4
+ def mcrImpl given (ctx : QuoteContext ): Expr [Any ] = {
5
+ val tpl : Expr [1 ] = ' {1 }
6
+ ' {()}
7
+ }
You can’t perform that action at this time.
0 commit comments