@@ -13,21 +13,21 @@ import dotty.tools.dotc.quoted.reflect._
13
13
import dotty .tools .dotc .quoted .QuoteUtils ._
14
14
import dotty .tools .dotc .core .Decorators ._
15
15
16
- import scala .quoted .QuoteContext
16
+ import scala .quoted .Quotes
17
17
import scala .quoted .internal .{QuoteUnpickler , QuoteMatching }
18
18
import dotty .tools .dotc .quoted .printers .{Extractors , SourceCode , SyntaxHighlight }
19
19
20
20
import scala .tasty .reflect ._
21
21
22
- object QuoteContextImpl {
22
+ object QuotesImpl {
23
23
24
24
type ScopeId = Int
25
25
26
- def apply ()(using Context ): QuoteContext =
27
- new QuoteContextImpl (ctx)
26
+ def apply ()(using Context ): Quotes =
27
+ new QuotesImpl (ctx)
28
28
29
29
def showDecompiledTree (tree : tpd.Tree )(using Context ): String = {
30
- val qctx : QuoteContextImpl = new QuoteContextImpl (MacroExpansion .context(tree))
30
+ val qctx : QuotesImpl = new QuotesImpl (MacroExpansion .context(tree))
31
31
if ctx.settings.color.value == " always" then
32
32
qctx.reflect.TreeMethodsImpl .temporaryShowAnsiColored(tree)
33
33
else
@@ -41,7 +41,7 @@ object QuoteContextImpl {
41
41
42
42
}
43
43
44
- class QuoteContextImpl private (ctx : Context ) extends QuoteContext , QuoteUnpickler , QuoteMatching :
44
+ class QuotesImpl private (ctx : Context ) extends Quotes , QuoteUnpickler , QuoteMatching :
45
45
46
46
extension [T ](self : scala.quoted.Expr [T ]):
47
47
def show : String =
@@ -55,7 +55,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl
55
55
56
56
def asReflectTree : reflect.Term =
57
57
val expr = self.asInstanceOf [ExprImpl ]
58
- expr.checkScopeId(QuoteContextImpl .this .hashCode)
58
+ expr.checkScopeId(QuotesImpl .this .hashCode)
59
59
expr.tree
60
60
61
61
end extension
@@ -94,11 +94,11 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl
94
94
def pos : Position = self.sourcePos
95
95
def symbol : Symbol = self.symbol
96
96
def showExtractors : String =
97
- Extractors .showTree(using QuoteContextImpl .this )(self)
97
+ Extractors .showTree(using QuotesImpl .this )(self)
98
98
def show : String =
99
- SourceCode .showTree(using QuoteContextImpl .this )(self)(SyntaxHighlight .plain)
99
+ SourceCode .showTree(using QuotesImpl .this )(self)(SyntaxHighlight .plain)
100
100
def showAnsiColored : String =
101
- SourceCode .showTree(using QuoteContextImpl .this )(self)(SyntaxHighlight .ANSI )
101
+ SourceCode .showTree(using QuotesImpl .this )(self)(SyntaxHighlight .ANSI )
102
102
def isExpr : Boolean =
103
103
self match
104
104
case TermTypeTest (self) =>
@@ -108,15 +108,15 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl
108
108
case _ => false
109
109
def asExpr : scala.quoted.Expr [Any ] =
110
110
if self.isExpr then
111
- new ExprImpl (self, QuoteContextImpl .this .hashCode)
111
+ new ExprImpl (self, QuotesImpl .this .hashCode)
112
112
else self match
113
113
case TermTypeTest (self) => throw new Exception (" Expected an expression. This is a partially applied Term. Try eta-expanding the term first." )
114
114
case _ => throw new Exception (" Expected a Term but was: " + self)
115
115
end extension
116
116
117
117
extension [T ](self : Tree )
118
118
def asExprOf (using tp : scala.quoted.Type [T ]): scala.quoted.Expr [T ] =
119
- QuoteContextImpl .this .asExprOf[T ](self.asExpr)(using tp)
119
+ QuotesImpl .this .asExprOf[T ](self.asExpr)(using tp)
120
120
end extension
121
121
122
122
end TreeMethodsImpl
@@ -352,11 +352,11 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl
352
352
object TermMethodsImpl extends TermMethods :
353
353
extension (self : Term ):
354
354
def seal : scala.quoted.Expr [Any ] =
355
- if self.isExpr then new ExprImpl (self, QuoteContextImpl .this .hashCode)
355
+ if self.isExpr then new ExprImpl (self, QuotesImpl .this .hashCode)
356
356
else throw new Exception (" Cannot seal a partially applied Term. Try eta-expanding the term first." )
357
357
358
358
def sealOpt : Option [scala.quoted.Expr [Any ]] =
359
- if self.isExpr then Some (new ExprImpl (self, QuoteContextImpl .this .hashCode))
359
+ if self.isExpr then Some (new ExprImpl (self, QuotesImpl .this .hashCode))
360
360
else None
361
361
362
362
def tpe : TypeRepr = self.tpe
@@ -1634,18 +1634,18 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl
1634
1634
object TypeReprMethodsImpl extends TypeReprMethods :
1635
1635
extension (self : TypeRepr ):
1636
1636
def showExtractors : String =
1637
- Extractors .showType(using QuoteContextImpl .this )(self)
1637
+ Extractors .showType(using QuotesImpl .this )(self)
1638
1638
1639
1639
def show : String =
1640
- SourceCode .showType(using QuoteContextImpl .this )(self)(SyntaxHighlight .plain)
1640
+ SourceCode .showType(using QuotesImpl .this )(self)(SyntaxHighlight .plain)
1641
1641
1642
1642
def showAnsiColored : String =
1643
- SourceCode .showType(using QuoteContextImpl .this )(self)(SyntaxHighlight .ANSI )
1643
+ SourceCode .showType(using QuotesImpl .this )(self)(SyntaxHighlight .ANSI )
1644
1644
1645
1645
def seal : scala.quoted.Type [_] = self.asType
1646
1646
1647
1647
def asType : scala.quoted.Type [? ] =
1648
- new TypeImpl (Inferred (self), QuoteContextImpl .this .hashCode)
1648
+ new TypeImpl (Inferred (self), QuotesImpl .this .hashCode)
1649
1649
1650
1650
def =:= (that : TypeRepr ): Boolean = self =:= that
1651
1651
def <:< (that : TypeRepr ): Boolean = self <:< that
@@ -2219,11 +2219,11 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl
2219
2219
extension (self : Constant ):
2220
2220
def value : Any = self.value
2221
2221
def showExtractors : String =
2222
- Extractors .showConstant(using QuoteContextImpl .this )(self)
2222
+ Extractors .showConstant(using QuotesImpl .this )(self)
2223
2223
def show : String =
2224
- SourceCode .showConstant(using QuoteContextImpl .this )(self)(SyntaxHighlight .plain)
2224
+ SourceCode .showConstant(using QuotesImpl .this )(self)(SyntaxHighlight .plain)
2225
2225
def showAnsiColored : String =
2226
- SourceCode .showConstant(using QuoteContextImpl .this )(self)(SyntaxHighlight .ANSI )
2226
+ SourceCode .showConstant(using QuotesImpl .this )(self)(SyntaxHighlight .ANSI )
2227
2227
end extension
2228
2228
end ConstantMethodsImpl
2229
2229
@@ -2442,11 +2442,11 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl
2442
2442
def children : List [Symbol ] = self.denot.children
2443
2443
2444
2444
def showExtractors : String =
2445
- Extractors .showSymbol(using QuoteContextImpl .this )(self)
2445
+ Extractors .showSymbol(using QuotesImpl .this )(self)
2446
2446
def show : String =
2447
- SourceCode .showSymbol(using QuoteContextImpl .this )(self)(SyntaxHighlight .plain)
2447
+ SourceCode .showSymbol(using QuotesImpl .this )(self)(SyntaxHighlight .plain)
2448
2448
def showAnsiColored : String =
2449
- SourceCode .showSymbol(using QuoteContextImpl .this )(self)(SyntaxHighlight .ANSI )
2449
+ SourceCode .showSymbol(using QuotesImpl .this )(self)(SyntaxHighlight .ANSI )
2450
2450
2451
2451
end extension
2452
2452
@@ -2578,11 +2578,11 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl
2578
2578
def | (that : Flags ): Flags = dotc.core.Flags .or(self, that) // TODO: Replace with dotc.core.Flags.|(self)(that) once extension names have stabilized
2579
2579
def & (that : Flags ): Flags = dotc.core.Flags .and(self, that)// TODO: Replace with dotc.core.Flags.&(self)(that) once extension names have stabilized
2580
2580
def showExtractors : String =
2581
- Extractors .showFlags(using QuoteContextImpl .this )(self)
2581
+ Extractors .showFlags(using QuotesImpl .this )(self)
2582
2582
def show : String =
2583
- SourceCode .showFlags(using QuoteContextImpl .this )(self)(SyntaxHighlight .plain)
2583
+ SourceCode .showFlags(using QuotesImpl .this )(self)(SyntaxHighlight .plain)
2584
2584
def showAnsiColored : String =
2585
- SourceCode .showFlags(using QuoteContextImpl .this )(self)(SyntaxHighlight .ANSI )
2585
+ SourceCode .showFlags(using QuotesImpl .this )(self)(SyntaxHighlight .ANSI )
2586
2586
end extension
2587
2587
end FlagsMethodsImpl
2588
2588
@@ -2658,18 +2658,18 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl
2658
2658
2659
2659
end reflect
2660
2660
2661
- def unpickleExpr [T ](pickled : String | List [String ], typeHole : (Int , Seq [Any ]) => scala.quoted.Type [? ], termHole : (Int , Seq [Any ], scala.quoted.QuoteContext ) => scala.quoted.Expr [? ]): scala.quoted.Expr [T ] =
2661
+ def unpickleExpr [T ](pickled : String | List [String ], typeHole : (Int , Seq [Any ]) => scala.quoted.Type [? ], termHole : (Int , Seq [Any ], scala.quoted.Quotes ) => scala.quoted.Expr [? ]): scala.quoted.Expr [T ] =
2662
2662
val tree = PickledQuotes .unpickleTerm(pickled, typeHole, termHole)(using reflect.rootContext)
2663
2663
new ExprImpl (tree, hash).asInstanceOf [scala.quoted.Expr [T ]]
2664
2664
2665
- def unpickleType [T <: AnyKind ](pickled : String | List [String ], typeHole : (Int , Seq [Any ]) => scala.quoted.Type [? ], termHole : (Int , Seq [Any ], scala.quoted.QuoteContext ) => scala.quoted.Expr [? ]): scala.quoted.Type [T ] =
2665
+ def unpickleType [T <: AnyKind ](pickled : String | List [String ], typeHole : (Int , Seq [Any ]) => scala.quoted.Type [? ], termHole : (Int , Seq [Any ], scala.quoted.Quotes ) => scala.quoted.Expr [? ]): scala.quoted.Type [T ] =
2666
2666
val tree = PickledQuotes .unpickleTypeTree(pickled, typeHole, termHole)(using reflect.rootContext)
2667
2667
new TypeImpl (tree, hash).asInstanceOf [scala.quoted.Type [T ]]
2668
2668
2669
2669
object ExprMatch extends ExprMatchModule :
2670
2670
def unapply [TypeBindings <: Tuple , Tup <: Tuple ](scrutinee : scala.quoted.Expr [Any ])(using pattern : scala.quoted.Expr [Any ]): Option [Tup ] =
2671
- val scrutineeTree = QuoteContextImpl .this .asReflectTree(scrutinee)
2672
- val patternTree = QuoteContextImpl .this .asReflectTree(pattern)
2671
+ val scrutineeTree = QuotesImpl .this .asReflectTree(scrutinee)
2672
+ val patternTree = QuotesImpl .this .asReflectTree(pattern)
2673
2673
treeMatch(scrutineeTree, patternTree).asInstanceOf [Option [Tup ]]
2674
2674
end ExprMatch
2675
2675
@@ -2708,7 +2708,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl
2708
2708
ctx1.gadt.addToConstraint(typeHoles)
2709
2709
ctx1
2710
2710
2711
- val qctx1 = dotty.tools.dotc.quoted.QuoteContextImpl ()(using ctx1)
2711
+ val qctx1 = dotty.tools.dotc.quoted.QuotesImpl ()(using ctx1)
2712
2712
2713
2713
val matcher = new Matcher .QuoteMatcher [qctx1.type ](qctx1) {
2714
2714
def patternHoleSymbol : qctx1.reflect.Symbol = dotc.core.Symbols .defn.InternalQuotedPatterns_patternHole .asInstanceOf
@@ -2732,7 +2732,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl
2732
2732
}
2733
2733
}
2734
2734
2735
- private [this ] val hash = QuoteContextImpl .scopeId(using ctx)
2735
+ private [this ] val hash = QuotesImpl .scopeId(using ctx)
2736
2736
override def hashCode : Int = hash
2737
2737
2738
- end QuoteContextImpl
2738
+ end QuotesImpl
0 commit comments