File tree 6 files changed +17
-19
lines changed
compiler/src/dotty/tools/dotc
src/scala/internal/quoted
src-bootstrapped/scala/quoted
staging/src/scala/quoted/staging
6 files changed +17
-19
lines changed Original file line number Diff line number Diff line change @@ -685,8 +685,6 @@ class Definitions {
685
685
686
686
@ tu lazy val QuotedExprClass : ClassSymbol = requiredClass(" scala.quoted.Expr" )
687
687
@ tu lazy val QuotedExprModule : Symbol = QuotedExprClass .companionModule
688
- @ tu lazy val QuotedExprModule_nullExpr : Symbol = QuotedExprModule .requiredMethod(nme.nullExpr)
689
- @ tu lazy val QuotedExprModule_unitExpr : Symbol = QuotedExprModule .requiredMethod(nme.unitExpr)
690
688
691
689
@ tu lazy val QuoteContextClass : ClassSymbol = requiredClass(" scala.quoted.QuoteContext" )
692
690
@@ -716,6 +714,8 @@ class Definitions {
716
714
717
715
@ tu lazy val InternalQuotedExprModule : Symbol = requiredModule(" scala.internal.quoted.Expr" )
718
716
@ tu lazy val InternalQuotedExpr_unapply : Symbol = InternalQuotedExprModule .requiredMethod(nme.unapply)
717
+ @ tu lazy val InternalQuotedExpr_null : Symbol = InternalQuotedExprModule .requiredMethod(nme.null_)
718
+ @ tu lazy val InternalQuotedExpr_unit : Symbol = InternalQuotedExprModule .requiredMethod(nme.Unit )
719
719
720
720
@ tu lazy val InternalQuotedTypeModule : Symbol = requiredModule(" scala.internal.quoted.Type" )
721
721
@ tu lazy val InternalQuotedType_unapply : Symbol = InternalQuotedTypeModule .requiredMethod(nme.unapply)
Original file line number Diff line number Diff line change @@ -535,7 +535,6 @@ object StdNames {
535
535
val notifyAll_ : N = " notifyAll"
536
536
val notify_ : N = " notify"
537
537
val null_ : N = " null"
538
- val nullExpr : N = " nullExpr"
539
538
val ofDim : N = " ofDim"
540
539
val on : N = " on"
541
540
val opaque : N = " opaque"
@@ -608,7 +607,6 @@ object StdNames {
608
607
val unapply : N = " unapply"
609
608
val unapplySeq : N = " unapplySeq"
610
609
val unbox : N = " unbox"
611
- val unitExpr : N = " unitExpr"
612
610
val universe : N = " universe"
613
611
val update : N = " update"
614
612
val updateDynamic : N = " updateDynamic"
Original file line number Diff line number Diff line change @@ -150,8 +150,8 @@ class ReifyQuotes extends MacroTransform {
150
150
def liftedValue (lifter : Symbol ) =
151
151
ref(lifter).appliedToType(originalTp).select(nme.toExpr).appliedTo(lit)
152
152
lit.const.tag match {
153
- case Constants .NullTag => ref(defn.QuotedExprModule_nullExpr )
154
- case Constants .UnitTag => ref(defn.QuotedExprModule_unitExpr )
153
+ case Constants .NullTag => ref(defn.InternalQuotedExpr_null )
154
+ case Constants .UnitTag => ref(defn.InternalQuotedExpr_unit )
155
155
case Constants .BooleanTag => liftedValue(defn.LiftableModule_BooleanIsLiftable )
156
156
case Constants .ByteTag => liftedValue(defn.LiftableModule_ByteIsLiftable )
157
157
case Constants .ShortTag => liftedValue(defn.LiftableModule_ShortIsLiftable )
Original file line number Diff line number Diff line change @@ -79,18 +79,6 @@ object Expr {
79
79
case Some (expr1) => expr1.seal.asInstanceOf [Expr [T ]]
80
80
case _ => expr
81
81
82
- /** Returns a null expresssion equivalent to `'{null}` */
83
- def nullExpr : QuoteContext ?=> Expr [Null ] = qctx ?=> {
84
- import qctx .tasty ._
85
- Literal (Constant (null )).seal.asInstanceOf [Expr [Null ]]
86
- }
87
-
88
- /** Returns a unit expresssion equivalent to `'{}` or `'{()}` */
89
- def unitExpr : QuoteContext ?=> Expr [Unit ] = qctx ?=> {
90
- import qctx .tasty ._
91
- Literal (Constant (())).seal.asInstanceOf [Expr [Unit ]]
92
- }
93
-
94
82
/** Returns an expression containing a block with the given statements and ending with the expresion
95
83
* Given list of statements `s1 :: s2 :: ... :: Nil` and an expression `e` the resulting expression
96
84
* will be equivalent to `'{ $s1; $s2; ...; $e }`.
Original file line number Diff line number Diff line change @@ -55,4 +55,16 @@ object Expr {
55
55
new Matcher .QuoteMatcher [qctx.type ].termMatch(scrutineeExpr.unseal, patternExpr.unseal, hasTypeSplices).asInstanceOf [Option [Tup ]]
56
56
}
57
57
58
+ /** Returns a null expresssion equivalent to `'{null}` */
59
+ def `null` : QuoteContext ?=> quoted.Expr [Null ] = qctx ?=> {
60
+ import qctx .tasty ._
61
+ Literal (Constant (null )).seal.asInstanceOf [quoted.Expr [Null ]]
62
+ }
63
+
64
+ /** Returns a unit expresssion equivalent to `'{}` or `'{()}` */
65
+ def Unit : QuoteContext ?=> quoted.Expr [Unit ] = qctx ?=> {
66
+ import qctx .tasty ._
67
+ Literal (Constant (())).seal.asInstanceOf [quoted.Expr [Unit ]]
68
+ }
69
+
58
70
}
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ package object staging:
37
37
var result : T = noResult.asInstanceOf [T ]
38
38
def dummyRun (using QuoteContext ): Expr [Unit ] = {
39
39
result = thunk
40
- Expr .unitExpr
40
+ ' {}
41
41
}
42
42
toolbox.run(dummyRun(using _))
43
43
assert(result != noResult) // toolbox.run should have thrown an exception
You can’t perform that action at this time.
0 commit comments