Skip to content

Add names to using parameters for cleaner docs #10518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions library/src-bootstrapped/scala/quoted/Expr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object Expr {
* To retain semantics the argument `ei` is bound as `val yi = ei` and by-name arguments to `def yi = ei`.
* Some bindings may be elided as an early optimization.
*/
def betaReduce[T](expr: Expr[T])(using Quotes): Expr[T] =
def betaReduce[T](expr: Expr[T])(using q: Quotes): Expr[T] =
import quotes.reflect._
Term.betaReduce(Term.of(expr)) match
case Some(expr1) => expr1.asExpr.asInstanceOf[Expr[T]]
Expand All @@ -23,13 +23,13 @@ object Expr {
* Given list of statements `s1 :: s2 :: ... :: Nil` and an expression `e` the resulting expression
* will be equivalent to `'{ $s1; $s2; ...; $e }`.
*/
def block[T](statements: List[Expr[Any]], expr: Expr[T])(using Quotes): Expr[T] = {
def block[T](statements: List[Expr[Any]], expr: Expr[T])(using q: Quotes): Expr[T] = {
import quotes.reflect._
Block(statements.map(Term.of), Term.of(expr)).asExpr.asInstanceOf[Expr[T]]
}

/** Lift a value into an expression containing the construction of that value */
def apply[T](x: T)(using lift: Liftable[T])(using Quotes): Expr[T] =
def apply[T](x: T)(using lift: Liftable[T])(using q: Quotes): Expr[T] =
lift.toExpr(x)

/** Lifts this sequence of expressions into an expression of a sequence
Expand All @@ -40,7 +40,7 @@ object Expr {
* `'{ Seq($e1, $e2, ...) }` typed as an `Expr[Seq[T]]`
* ```
*/
def ofSeq[T](xs: Seq[Expr[T]])(using Type[T])(using Quotes): Expr[Seq[T]] =
def ofSeq[T](xs: Seq[Expr[T]])(using Type[T])(using q: Quotes): Expr[Seq[T]] =
Varargs(xs)

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

/** Lifts this sequence of expressions into an expression of a tuple
Expand All @@ -60,7 +60,7 @@ object Expr {
* to an expression equivalent to
* `'{ ($e1, $e2, ...) }` typed as an `Expr[Tuple]`
*/
def ofTupleFromSeq(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = {
def ofTupleFromSeq(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] = {
seq.size match {
case 0 => '{ Tuple() }
case 1 => ofTupleFromSeq1(seq)
Expand Down Expand Up @@ -89,116 +89,116 @@ object Expr {
}
}

private def ofTupleFromSeq1(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
private def ofTupleFromSeq1(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] =
seq match
case Seq('{ $x1: t1 }) => '{ Tuple1($x1) }

private def ofTupleFromSeq2(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
private def ofTupleFromSeq2(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] =
seq match
case Seq('{ $x1: t1 }, '{ $x2: t2 }) => '{ Tuple2($x1, $x2) }

private def ofTupleFromSeq3(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
private def ofTupleFromSeq3(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] =
seq match
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }) => '{ Tuple3($x1, $x2, $x3) }

private def ofTupleFromSeq4(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
private def ofTupleFromSeq4(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] =
seq match
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }) =>
'{ Tuple4($x1, $x2, $x3, $x4) }

private def ofTupleFromSeq5(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
private def ofTupleFromSeq5(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] =
seq match
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }) =>
'{ Tuple5($x1, $x2, $x3, $x4, $x5) }

private def ofTupleFromSeq6(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
private def ofTupleFromSeq6(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] =
seq match
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }) =>
'{ Tuple6($x1, $x2, $x3, $x4, $x5, $x6) }

private def ofTupleFromSeq7(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
private def ofTupleFromSeq7(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] =
seq match
case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }) =>
'{ Tuple7($x1, $x2, $x3, $x4, $x5, $x6, $x7) }

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

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

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

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

private def ofTupleFromSeq12(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
private def ofTupleFromSeq12(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] =
seq match
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 }) =>
'{ Tuple12($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12) }

private def ofTupleFromSeq13(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
private def ofTupleFromSeq13(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] =
seq match
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 }) =>
'{ Tuple13($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13) }

private def ofTupleFromSeq14(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
private def ofTupleFromSeq14(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] =
seq match
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 }) =>
'{ Tuple14($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14) }

private def ofTupleFromSeq15(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
private def ofTupleFromSeq15(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] =
seq match
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 }) =>
'{ Tuple15($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15) }

private def ofTupleFromSeq16(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
private def ofTupleFromSeq16(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] =
seq match
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 }) =>
'{ Tuple16($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16) }

private def ofTupleFromSeq17(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
private def ofTupleFromSeq17(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] =
seq match
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 }) =>
'{ Tuple17($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17) }

private def ofTupleFromSeq18(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
private def ofTupleFromSeq18(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] =
seq match
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 }) =>
'{ Tuple18($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18) }

private def ofTupleFromSeq19(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
private def ofTupleFromSeq19(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] =
seq match
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 }) =>
'{ Tuple19($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18, $x19) }

private def ofTupleFromSeq20(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
private def ofTupleFromSeq20(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] =
seq match
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 }) =>
'{ Tuple20($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18, $x19, $x20) }

private def ofTupleFromSeq21(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
private def ofTupleFromSeq21(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] =
seq match
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 }) =>
'{ Tuple21($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18, $x19, $x20, $x21) }

private def ofTupleFromSeq22(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] =
private def ofTupleFromSeq22(seq: Seq[Expr[Any]])(using q: Quotes): Expr[Tuple] =
seq match
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 }) =>
'{ Tuple22($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18, $x19, $x20, $x21, $x22) }


/** Given a tuple of the form `(Expr[A1], ..., Expr[An])`, outputs a tuple `Expr[(A1, ..., An)]`. */
def ofTuple[T <: Tuple: Tuple.IsMappedBy[Expr]: Type](tup: T)(using Quotes): Expr[Tuple.InverseMap[T, Expr]] = {
def ofTuple[T <: Tuple: Tuple.IsMappedBy[Expr]](tup: T)(using t: Type[T])(using q: Quotes): Expr[Tuple.InverseMap[T, Expr]] = {
val elems: Seq[Expr[Any]] = tup.asInstanceOf[Product].productIterator.toSeq.asInstanceOf[Seq[Expr[Any]]]
ofTupleFromSeq(elems).asExprOf[Tuple.InverseMap[T, Expr]]
}
Expand All @@ -209,7 +209,7 @@ object Expr {
*
* @tparam T type of the implicit parameter
*/
def summon[T](using Type[T])(using Quotes): Option[Expr[T]] = {
def summon[T](using Type[T])(using q: Quotes): Option[Expr[T]] = {
import quotes.reflect._
Implicits.search(TypeRepr.of[T]) match {
case iss: ImplicitSearchSuccess => Some(iss.tree.asExpr.asInstanceOf[Expr[T]])
Expand All @@ -221,7 +221,7 @@ object Expr {
/** Matches a `StringContext(part0, part1, ...)` and extracts the parts of a call to if the
* parts are passed explicitly. Returns the equvalent to `Seq('{part0}, '{part1}, ...)`.
*/
def unapply(sc: Expr[StringContext])(using Quotes): Option[Seq[Expr[String]]] =
def unapply(sc: Expr[StringContext])(using q: Quotes): Option[Seq[Expr[String]]] =
sc match
case '{ scala.StringContext(${Varargs(parts)}: _*) } => Some(parts)
case '{ new scala.StringContext(${Varargs(parts)}: _*) } => Some(parts)
Expand Down
4 changes: 2 additions & 2 deletions library/src/scala/quoted/ExprMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package scala.quoted
trait ExprMap:

/** Map an expression `e` with a type `T` */
def transform[T](e: Expr[T])(using Quotes, Type[T]): Expr[T]
def transform[T](e: Expr[T])(using q: Quotes, t: Type[T]): Expr[T]

/** Map subexpressions an expression `e` with a type `T` */
def transformChildren[T](e: Expr[T])(using Quotes, Type[T]): Expr[T] = {
def transformChildren[T](e: Expr[T])(using q: Quotes, t: Type[T]): Expr[T] = {
import quotes.reflect._
final class MapChildren() {

Expand Down
14 changes: 7 additions & 7 deletions library/src/scala/quoted/Quotes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
* Returns `None` if the expression does not contain a value or contains side effects.
* Otherwise returns the `Some` of the value.
*/
def unlift(using Unliftable[T]): Option[T] =
def unlift(using u: Unliftable[T]): Option[T] =
summon[Unliftable[T]].fromExpr(self)(using Quotes.this)

/** Return the unlifted value of this expression.
*
* Emits an error and throws if the expression does not contain a value or contains side effects.
* Otherwise returns the value.
*/
def unliftOrError(using Unliftable[T]): T =
def unliftOrError(using u: Unliftable[T]): T =
def reportError =
val msg = s"Expected a known value. \n\nThe value of: ${self.show}\ncould not be unlifted using $unlift"
reflect.report.throwError(msg, self)
Expand All @@ -57,10 +57,10 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
// Extension methods for `Expr[Any]` that take another explicit type parameter
extension [X](self: Expr[Any]):
/** Checks is the `quoted.Expr[?]` is valid expression of type `X` */
def isExprOf(using Type[X]): Boolean
def isExprOf(using t: Type[X]): Boolean

/** Convert this to an `quoted.Expr[X]` if this expression is a valid expression of type `X` or throws */
def asExprOf(using Type[X]): Expr[X]
def asExprOf(using t: Type[X]): Expr[X]
end extension

/** Low-level Typed AST API metaprogramming API.
Expand Down Expand Up @@ -230,7 +230,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>

/** Convert this tree to an `quoted.Expr[T]` if the tree is a valid expression or throws */
extension [T](self: Tree)
def asExprOf(using Type[T]): Expr[T]
def asExprOf(using t: Type[T]): Expr[T]

extension [ThisTree <: Tree](self: ThisTree):
/** Changes the owner of the symbols in the tree */
Expand Down Expand Up @@ -1514,7 +1514,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
/** Methods of the module object `val TypeTree` */
trait TypeTreeModule { this: TypeTree.type =>
/** Returns the tree of type or kind (TypeTree) of T */
def of[T <: AnyKind](using Type[T]): TypeTree
def of[T <: AnyKind](using t: Type[T]): TypeTree
}

/** Makes extension methods on `TypeTree` available without any imports */
Expand Down Expand Up @@ -2341,7 +2341,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
/** Methods of the module object `val TypeRepr` */
trait TypeReprModule { this: TypeRepr.type =>
/** Returns the type or kind (TypeRepr) of T */
def of[T <: AnyKind](using Type[T]): TypeRepr
def of[T <: AnyKind](using t: Type[T]): TypeRepr

/** Returns the type constructor of the runtime (erased) class */
def typeConstructorOf(clazz: Class[?]): TypeRepr
Expand Down
4 changes: 2 additions & 2 deletions library/src/scala/quoted/Type.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ end Type
object Type:

/** Show a source code like representation of this type without syntax highlight */
def show[T](using Type[T])(using Quotes): String =
def show[T](using t: Type[T])(using q: Quotes): String =
quotes.reflect.TypeTree.of[T].show

/** Shows the tree as fully typed source code colored with ANSI */
def showAnsiColored[T](using Type[T])(using Quotes): String =
def showAnsiColored[T](using t: Type[T])(using q: Quotes): String =
quotes.reflect.TypeTree.of[T].showAnsiColored

/** Return a quoted.Type with the given type */
Expand Down
6 changes: 3 additions & 3 deletions library/src/scala/quoted/Unlifted.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ object Unlifted {
* }
* ```
*/
def unapply[T](expr: Expr[T])(using Unliftable[T])(using Quotes): Option[T] =
summon[Unliftable[T]].fromExpr(expr)
def unapply[T](expr: Expr[T])(using u: Unliftable[T])(using q: Quotes): Option[T] =
u.fromExpr(expr)

/** Matches literal sequence of literal constant value expressions and return a sequence of values.
*
Expand All @@ -27,7 +27,7 @@ object Unlifted {
* }
* ```
*/
def unapply[T](exprs: Seq[Expr[T]])(using unlift: Unliftable[T], qctx: Quotes): Option[Seq[T]] =
def unapply[T](exprs: Seq[Expr[T]])(using u: Unliftable[T], q: Quotes): Option[Seq[T]] =
exprs.foldRight(Option(List.empty[T])) { (elem, acc) =>
(elem, acc) match {
case (Unlifted(value), Some(lst)) => Some(value :: lst)
Expand Down
4 changes: 2 additions & 2 deletions library/src/scala/quoted/Varargs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ object Varargs {
* '{ List(${Varargs(List(1, 2, 3))}: _*) } // equvalent to '{ List(1, 2, 3) }
* ```
*/
def apply[T](xs: Seq[Expr[T]])(using Type[T])(using Quotes): Expr[Seq[T]] = {
def apply[T](xs: Seq[Expr[T]])(using t: Type[T])(using q: Quotes): Expr[Seq[T]] = {
import quotes.reflect._
Repeated(xs.map(Term.of).toList, TypeTree.of[T]).asExpr.asInstanceOf[Expr[Seq[T]]]
}
Expand All @@ -32,7 +32,7 @@ object Varargs {
* }
* ```
*/
def unapply[T](expr: Expr[Seq[T]])(using Quotes): Option[Seq[Expr[T]]] = {
def unapply[T](expr: Expr[Seq[T]])(using q: Quotes): Option[Seq[Expr[T]]] = {
import quotes.reflect._
def rec(tree: Term): Option[Seq[Expr[T]]] = tree match {
case Typed(Repeated(elems, _), _) => Some(elems.map(x => x.asExpr.asInstanceOf[Expr[T]]))
Expand Down