Skip to content

Commit c8fe6b3

Browse files
committed
Use q as default parameter name for Quotes
Also remove unnecessary names for `Quotes`
1 parent 0dcdd61 commit c8fe6b3

File tree

194 files changed

+328
-326
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+328
-326
lines changed

compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ object PickledQuotes {
7474
override def transform(tree: tpd.Tree)(using Context): tpd.Tree = tree match {
7575
case Hole(isTerm, idx, args) =>
7676
val reifiedArgs = args.map { arg =>
77-
if (arg.isTerm) (using qctx: Quotes) => new ExprImpl(arg, QuotesImpl.scopeId)
77+
if (arg.isTerm) (using q: Quotes) => new ExprImpl(arg, QuotesImpl.scopeId)
7878
else new TypeImpl(arg, QuotesImpl.scopeId)
7979
}
8080
if isTerm then

compiler/src/scala/quoted/runtime/impl/TypeImpl.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ final class TypeImpl(val typeTree: tpd.Tree, val scopeId: Int) extends Type[?] {
1414
}
1515

1616
/** View this expression `quoted.Type[T]` as a `TypeTree` */
17-
def unseal(using qctx: Quotes): qctx.reflect.TypeTree =
17+
def unseal(using Quotes): qctx.reflect.TypeTree =
1818
checkScopeId(qctx.hashCode)
1919
typeTree.asInstanceOf[qctx.reflect.TypeTree]
2020

compiler/test-resources/repl-macros/i5551

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
scala> import scala.quoted._
2-
scala> def assertImpl(expr: Expr[Boolean])(using qctx: Quotes) = '{ if !($expr) then throw new AssertionError("failed assertion")}
2+
scala> def assertImpl(expr: Expr[Boolean])(using q: Quotes) = '{ if !($expr) then throw new AssertionError("failed assertion")}
33
def assertImpl
44
(expr: quoted.Expr[Boolean])
5-
(using qctx: quoted.Quotes): quoted.Expr[Unit]
5+
(using q: quoted.Quotes): quoted.Expr[Unit]
66
scala> inline def assert(expr: => Boolean): Unit = ${ assertImpl('{expr}) }
77
def assert(expr: => Boolean): Unit
88

docs/docs/reference/contextual/derivation-macro.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ we need to implement a method `Eq.derived` on the companion object of `Eq` that
2525
produces a quoted instance for `Eq[T]`. Here is a possible signature,
2626

2727
```scala
28-
given derived[T: Type](using qctx: Quotes) as Expr[Eq[T]]
28+
given derived[T: Type](using Quotes) as Expr[Eq[T]]
2929
```
3030

3131
and for comparison reasons we give the same signature we had with `inline`:
@@ -41,7 +41,7 @@ from the signature. The body of the `derived` method is shown below:
4141

4242

4343
```scala
44-
given derived[T: Type](using qctx: Quotes) as Expr[Eq[T]] = {
44+
given derived[T: Type](using Quotes) as Expr[Eq[T]] = {
4545
import qctx.reflect._
4646

4747
val ev: Expr[Mirror.Of[T]] = Expr.summon[Mirror.Of[T]].get
@@ -91,7 +91,7 @@ The implementation of `summonAll` as a macro can be show below assuming that we
9191
have the given instances for our primitive types:
9292

9393
```scala
94-
def summonAll[T: Type](using qctx: Quotes): List[Expr[Eq[_]]] = Type.of[T] match {
94+
def summonAll[T: Type](using Quotes): List[Expr[Eq[_]]] = Type.of[T] match {
9595
case '[String *: tpes] => '{ summon[Eq[String]] } :: summonAll[tpes]
9696
case '[Int *: tpes] => '{ summon[Eq[Int]] } :: summonAll[tpes]
9797
case '[tpe *: tpes] => derived[tpe] :: summonAll[tpes]
@@ -169,14 +169,14 @@ object Eq {
169169
def eqv(x: T, y: T): Boolean = body(x, y)
170170
}
171171

172-
def summonAll[T: Type](using qctx: Quotes): List[Expr[Eq[_]]] = Type.of[T] match {
172+
def summonAll[T: Type](using Quotes): List[Expr[Eq[_]]] = Type.of[T] match {
173173
case '[String *: tpes] => '{ summon[Eq[String]] } :: summonAll[tpes]
174174
case '[Int *: tpes] => '{ summon[Eq[Int]] } :: summonAll[tpes]
175175
case '[tpe *: tpes] => derived[tpe] :: summonAll[tpes]
176176
case '[EmptyTuple] => Nil
177177
}
178178

179-
given derived[T: Type](using qctx: Quotes) as Expr[Eq[T]] = {
179+
given derived[T: Type](using q: Quotes) as Expr[Eq[T]] = {
180180
import qctx.reflect._
181181

182182
val ev: Expr[Mirror.Of[T]] = Expr.summon[Mirror.Of[T]].get

docs/docs/reference/metaprogramming/tasty-reflect.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import scala.quoted._
2828

2929
inline def natConst(inline x: Int): Int = ${natConstImpl('{x})}
3030

31-
def natConstImpl(x: Expr[Int])(using qctx: Quotes): Expr[Int] = {
31+
def natConstImpl(x: Expr[Int])(using Quotes): Expr[Int] = {
3232
import qctx.reflect._
3333
...
3434
}
@@ -40,7 +40,7 @@ def natConstImpl(x: Expr[Int])(using qctx: Quotes): Expr[Int] = {
4040
trees. For example the `Literal(_)` extractor used below.
4141

4242
```scala
43-
def natConstImpl(x: Expr[Int])(using qctx: Quotes): Expr[Int] = {
43+
def natConstImpl(x: Expr[Int])(using Quotes): Expr[Int] = {
4444
import qctx.reflect._
4545
val xTree: Term = Term.of(x)
4646
xTree match {

library/src-bootstrapped/scala/quoted/Expr.scala

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ object Expr {
1313
* To retain semantics the argument `ei` is bound as `val yi = ei` and by-name arguments to `def yi = ei`.
1414
* Some bindings may be elided as an early optimization.
1515
*/
16-
def betaReduce[T](expr: Expr[T])(using qctx: Quotes): Expr[T] =
16+
def betaReduce[T](expr: Expr[T])(using Quotes): Expr[T] =
1717
import qctx.reflect._
1818
Term.betaReduce(Term.of(expr)) match
1919
case Some(expr1) => expr1.asExpr.asInstanceOf[Expr[T]]
@@ -23,13 +23,14 @@ object Expr {
2323
* Given list of statements `s1 :: s2 :: ... :: Nil` and an expression `e` the resulting expression
2424
* will be equivalent to `'{ $s1; $s2; ...; $e }`.
2525
*/
26-
def block[T](statements: List[Expr[Any]], expr: Expr[T])(using qctx: Quotes): Expr[T] = {
26+
def block[T](statements: List[Expr[Any]], expr: Expr[T])(using Quotes): Expr[T] = {
2727
import qctx.reflect._
2828
Block(statements.map(Term.of), Term.of(expr)).asExpr.asInstanceOf[Expr[T]]
2929
}
3030

3131
/** Lift a value into an expression containing the construction of that value */
32-
def apply[T](x: T)(using qctx: Quotes, lift: Liftable[T]): Expr[T] = lift.toExpr(x)
32+
def apply[T](x: T)(using lift: Liftable[T])(using Quotes): Expr[T] =
33+
lift.toExpr(x)
3334

3435
/** Lifts this sequence of expressions into an expression of a sequence
3536
*
@@ -39,7 +40,8 @@ object Expr {
3940
* `'{ Seq($e1, $e2, ...) }` typed as an `Expr[Seq[T]]`
4041
* ```
4142
*/
42-
def ofSeq[T](xs: Seq[Expr[T]])(using tp: Type[T], qctx: Quotes): Expr[Seq[T]] = Varargs(xs)
43+
def ofSeq[T](xs: Seq[Expr[T]])(using tp: Type[T], qctx: Quotes): Expr[Seq[T]] =
44+
Varargs(xs)
4345

4446
/** Lifts this list of expressions into an expression of a list
4547
*
@@ -48,7 +50,7 @@ object Expr {
4850
* to an expression equivalent to
4951
* `'{ List($e1, $e2, ...) }` typed as an `Expr[List[T]]`
5052
*/
51-
def ofList[T](xs: Seq[Expr[T]])(using Type[T], Quotes): Expr[List[T]] =
53+
def ofList[T](xs: Seq[Expr[T]])(using Type[T])(using Quotes): Expr[List[T]] =
5254
if (xs.isEmpty) Expr(Nil) else '{ List(${Varargs(xs)}: _*) }
5355

5456
/** Lifts this sequence of expressions into an expression of a tuple
@@ -58,7 +60,7 @@ object Expr {
5860
* to an expression equivalent to
5961
* `'{ ($e1, $e2, ...) }` typed as an `Expr[Tuple]`
6062
*/
61-
def ofTupleFromSeq(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] = {
63+
def ofTupleFromSeq(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = {
6264
seq.size match {
6365
case 0 => '{ Tuple() }
6466
case 1 => ofTupleFromSeq1(seq)
@@ -87,116 +89,116 @@ object Expr {
8789
}
8890
}
8991

90-
private def ofTupleFromSeq1(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
92+
private def ofTupleFromSeq1(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
9193
seq match
9294
case Seq('{ $x1: t1 }) => '{ Tuple1($x1) }
9395

94-
private def ofTupleFromSeq2(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
96+
private def ofTupleFromSeq2(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
9597
seq match
9698
case Seq('{ $x1: t1 }, '{ $x2: t2 }) => '{ Tuple2($x1, $x2) }
9799

98-
private def ofTupleFromSeq3(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
100+
private def ofTupleFromSeq3(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
99101
seq match
100102
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }) => '{ Tuple3($x1, $x2, $x3) }
101103

102-
private def ofTupleFromSeq4(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
104+
private def ofTupleFromSeq4(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
103105
seq match
104106
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }) =>
105107
'{ Tuple4($x1, $x2, $x3, $x4) }
106108

107-
private def ofTupleFromSeq5(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
109+
private def ofTupleFromSeq5(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
108110
seq match
109111
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }) =>
110112
'{ Tuple5($x1, $x2, $x3, $x4, $x5) }
111113

112-
private def ofTupleFromSeq6(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
114+
private def ofTupleFromSeq6(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
113115
seq match
114116
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }) =>
115117
'{ Tuple6($x1, $x2, $x3, $x4, $x5, $x6) }
116118

117-
private def ofTupleFromSeq7(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
119+
private def ofTupleFromSeq7(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
118120
seq match
119121
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }) =>
120122
'{ Tuple7($x1, $x2, $x3, $x4, $x5, $x6, $x7) }
121123

122-
private def ofTupleFromSeq8(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
124+
private def ofTupleFromSeq8(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
123125
seq match
124126
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }) =>
125127
'{ Tuple8($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8) }
126128

127-
private def ofTupleFromSeq9(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
129+
private def ofTupleFromSeq9(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
128130
seq match
129131
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }) =>
130132
'{ Tuple9($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9) }
131133

132-
private def ofTupleFromSeq10(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
134+
private def ofTupleFromSeq10(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
133135
seq match
134136
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }) =>
135137
'{ Tuple10($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10) }
136138

137-
private def ofTupleFromSeq11(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
139+
private def ofTupleFromSeq11(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
138140
seq match
139141
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }) =>
140142
'{ Tuple11($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11) }
141143

142-
private def ofTupleFromSeq12(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
144+
private def ofTupleFromSeq12(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
143145
seq match
144146
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }) =>
145147
'{ Tuple12($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12) }
146148

147-
private def ofTupleFromSeq13(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
149+
private def ofTupleFromSeq13(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
148150
seq match
149151
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }) =>
150152
'{ Tuple13($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13) }
151153

152-
private def ofTupleFromSeq14(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
154+
private def ofTupleFromSeq14(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
153155
seq match
154156
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }, '{ $x14: t14 }) =>
155157
'{ Tuple14($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14) }
156158

157-
private def ofTupleFromSeq15(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
159+
private def ofTupleFromSeq15(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
158160
seq match
159161
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }, '{ $x14: t14 }, '{ $x15: t15 }) =>
160162
'{ Tuple15($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15) }
161163

162-
private def ofTupleFromSeq16(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
164+
private def ofTupleFromSeq16(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
163165
seq match
164166
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }, '{ $x14: t14 }, '{ $x15: t15 }, '{ $x16: t16 }) =>
165167
'{ Tuple16($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16) }
166168

167-
private def ofTupleFromSeq17(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
169+
private def ofTupleFromSeq17(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
168170
seq match
169171
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }, '{ $x14: t14 }, '{ $x15: t15 }, '{ $x16: t16 }, '{ $x17: t17 }) =>
170172
'{ Tuple17($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17) }
171173

172-
private def ofTupleFromSeq18(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
174+
private def ofTupleFromSeq18(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
173175
seq match
174176
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }, '{ $x14: t14 }, '{ $x15: t15 }, '{ $x16: t16 }, '{ $x17: t17 }, '{ $x18: t18 }) =>
175177
'{ Tuple18($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18) }
176178

177-
private def ofTupleFromSeq19(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
179+
private def ofTupleFromSeq19(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
178180
seq match
179181
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }, '{ $x14: t14 }, '{ $x15: t15 }, '{ $x16: t16 }, '{ $x17: t17 }, '{ $x18: t18 }, '{ $x19: t19 }) =>
180182
'{ Tuple19($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18, $x19) }
181183

182-
private def ofTupleFromSeq20(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
184+
private def ofTupleFromSeq20(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
183185
seq match
184186
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }, '{ $x14: t14 }, '{ $x15: t15 }, '{ $x16: t16 }, '{ $x17: t17 }, '{ $x18: t18 }, '{ $x19: t19 }, '{ $x20: t20 }) =>
185187
'{ Tuple20($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18, $x19, $x20) }
186188

187-
private def ofTupleFromSeq21(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
189+
private def ofTupleFromSeq21(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
188190
seq match
189191
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }, '{ $x14: t14 }, '{ $x15: t15 }, '{ $x16: t16 }, '{ $x17: t17 }, '{ $x18: t18 }, '{ $x19: t19 }, '{ $x20: t20 }, '{ $x21: t21 }) =>
190192
'{ Tuple21($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18, $x19, $x20, $x21) }
191193

192-
private def ofTupleFromSeq22(seq: Seq[Expr[Any]])(using qctx: Quotes): Expr[Tuple] =
194+
private def ofTupleFromSeq22(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
193195
seq match
194196
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }, '{ $x14: t14 }, '{ $x15: t15 }, '{ $x16: t16 }, '{ $x17: t17 }, '{ $x18: t18 }, '{ $x19: t19 }, '{ $x20: t20 }, '{ $x21: t21 }, '{ $x22: t22 }) =>
195197
'{ Tuple22($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18, $x19, $x20, $x21, $x22) }
196198

197199

198200
/** Given a tuple of the form `(Expr[A1], ..., Expr[An])`, outputs a tuple `Expr[(A1, ..., An)]`. */
199-
def ofTuple[T <: Tuple: Tuple.IsMappedBy[Expr]: Type](tup: T)(using qctx: Quotes): Expr[Tuple.InverseMap[T, Expr]] = {
201+
def ofTuple[T <: Tuple: Tuple.IsMappedBy[Expr]: Type](tup: T)(using Quotes): Expr[Tuple.InverseMap[T, Expr]] = {
200202
val elems: Seq[Expr[Any]] = tup.asInstanceOf[Product].productIterator.toSeq.asInstanceOf[Seq[Expr[Any]]]
201203
ofTupleFromSeq(elems).asExprOf[Tuple.InverseMap[T, Expr]]
202204
}
@@ -209,7 +211,7 @@ object Expr {
209211
* @param tpe quoted type of the implicit parameter
210212
* @param qctx current context
211213
*/
212-
def summon[T](using tpe: Type[T])(using qctx: Quotes): Option[Expr[T]] = {
214+
def summon[T](using Type[T])(using Quotes): Option[Expr[T]] = {
213215
import qctx.reflect._
214216
Implicits.search(TypeRepr.of[T]) match {
215217
case iss: ImplicitSearchSuccess => Some(iss.tree.asExpr.asInstanceOf[Expr[T]])

library/src-bootstrapped/scala/quoted/ExprMap.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ package scala.quoted
22

33
trait ExprMap:
44

5-
/** Map an expression `e` with a type `tpe` */
6-
def transform[T](e: Expr[T])(using qctx: Quotes, tpe: Type[T]): Expr[T]
5+
/** Map an expression `e` with a type `T` */
6+
def transform[T](e: Expr[T])(using Quotes, Type[T]): Expr[T]
77

8-
/** Map subexpressions an expression `e` with a type `tpe` */
9-
def transformChildren[T](e: Expr[T])(using qctx: Quotes, tpe: Type[T]): Expr[T] = {
8+
/** Map subexpressions an expression `e` with a type `T` */
9+
def transformChildren[T](e: Expr[T])(using Quotes, Type[T]): Expr[T] = {
1010
import qctx.reflect._
1111
final class MapChildren() {
1212

library/src-bootstrapped/scala/quoted/Type.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ end Type
1212
object Type:
1313

1414
/** Show a source code like representation of this type without syntax highlight */
15-
def show[T](using tp: Type[T])(using qctx: Quotes): String =
15+
def show[T](using Type[T])(using Quotes): String =
1616
qctx.reflect.TypeTree.of[T].show
1717

1818
/** Shows the tree as fully typed source code colored with ANSI */
19-
def showAnsiColored[T](using tp: Type[T])(using qctx: Quotes): String =
19+
def showAnsiColored[T](using Type[T])(using Quotes): String =
2020
qctx.reflect.TypeTree.of[T].showAnsiColored
2121

2222
/** Return a quoted.Type with the given type */

library/src/scala/quoted/Const.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ object Const {
1414
* }
1515
* ```
1616
*/
17-
def unapply[T](expr: Expr[T])(using qctx: Quotes): Option[T] = {
17+
def unapply[T](expr: Expr[T])(using Quotes): Option[T] = {
1818
import qctx.reflect._
1919
def rec(tree: Term): Option[T] = tree match {
2020
case Literal(c) => Some(c.value.asInstanceOf[T])

library/src/scala/quoted/Consts.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ object Consts {
1515
* }
1616
* ```
1717
*/
18-
def unapply[T](exprs: Seq[Expr[T]])(using qctx: Quotes): Option[Seq[T]] =
18+
def unapply[T](exprs: Seq[Expr[T]])(using Quotes): Option[Seq[T]] =
1919
exprs.foldRight(Option(List.empty[T])) { (elem, acc) =>
2020
(elem, acc) match {
2121
case (Const(value), Some(lst)) => Some(value :: lst)

0 commit comments

Comments
 (0)