File tree Expand file tree Collapse file tree 6 files changed +17
-19
lines changed
compiler/src/dotty/tools/dotc
src-bootstrapped/scala/quoted
src/scala/internal/quoted
staging/src/scala/quoted/staging Expand file tree Collapse file tree 6 files changed +17
-19
lines changed Original file line number Diff line number Diff line change @@ -685,8 +685,6 @@ class Definitions {
685685
686686 @ tu lazy val QuotedExprClass : ClassSymbol = requiredClass(" scala.quoted.Expr" )
687687 @ 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)
690688
691689 @ tu lazy val QuoteContextClass : ClassSymbol = requiredClass(" scala.quoted.QuoteContext" )
692690
@@ -716,6 +714,8 @@ class Definitions {
716714
717715 @ tu lazy val InternalQuotedExprModule : Symbol = requiredModule(" scala.internal.quoted.Expr" )
718716 @ 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 )
719719
720720 @ tu lazy val InternalQuotedTypeModule : Symbol = requiredModule(" scala.internal.quoted.Type" )
721721 @ 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 {
535535 val notifyAll_ : N = " notifyAll"
536536 val notify_ : N = " notify"
537537 val null_ : N = " null"
538- val nullExpr : N = " nullExpr"
539538 val ofDim : N = " ofDim"
540539 val on : N = " on"
541540 val opaque : N = " opaque"
@@ -608,7 +607,6 @@ object StdNames {
608607 val unapply : N = " unapply"
609608 val unapplySeq : N = " unapplySeq"
610609 val unbox : N = " unbox"
611- val unitExpr : N = " unitExpr"
612610 val universe : N = " universe"
613611 val update : N = " update"
614612 val updateDynamic : N = " updateDynamic"
Original file line number Diff line number Diff line change @@ -150,8 +150,8 @@ class ReifyQuotes extends MacroTransform {
150150 def liftedValue (lifter : Symbol ) =
151151 ref(lifter).appliedToType(originalTp).select(nme.toExpr).appliedTo(lit)
152152 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 )
155155 case Constants .BooleanTag => liftedValue(defn.LiftableModule_BooleanIsLiftable )
156156 case Constants .ByteTag => liftedValue(defn.LiftableModule_ByteIsLiftable )
157157 case Constants .ShortTag => liftedValue(defn.LiftableModule_ShortIsLiftable )
Original file line number Diff line number Diff line change @@ -79,18 +79,6 @@ object Expr {
7979 case Some (expr1) => expr1.seal.asInstanceOf [Expr [T ]]
8080 case _ => expr
8181
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-
9482 /** Returns an expression containing a block with the given statements and ending with the expresion
9583 * Given list of statements `s1 :: s2 :: ... :: Nil` and an expression `e` the resulting expression
9684 * will be equivalent to `'{ $s1; $s2; ...; $e }`.
Original file line number Diff line number Diff line change @@ -55,4 +55,16 @@ object Expr {
5555 new Matcher .QuoteMatcher [qctx.type ].termMatch(scrutineeExpr.unseal, patternExpr.unseal, hasTypeSplices).asInstanceOf [Option [Tup ]]
5656 }
5757
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+
5870}
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ package object staging:
3737 var result : T = noResult.asInstanceOf [T ]
3838 def dummyRun (using QuoteContext ): Expr [Unit ] = {
3939 result = thunk
40- Expr .unitExpr
40+ ' {}
4141 }
4242 toolbox.run(dummyRun(using _))
4343 assert(result != noResult) // toolbox.run should have thrown an exception
You can’t perform that action at this time.
0 commit comments