Skip to content

Commit e8206d7

Browse files
committed
Use extension methods
1 parent 7764f97 commit e8206d7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

library/src/scala/tasty/Reflection.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -419,32 +419,32 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
419419
// QUOTES //
420420
////////////////
421421

422-
implicit class QuotedExprAPI[T](expr: scala.quoted.Expr[T]) {
422+
given QuotedExprOps: extension (expr: scala.quoted.Expr[?]) {
423423
/** View this expression `quoted.Expr[T]` as a `Term` */
424424
def unseal(given ctx: Context): Term =
425425
internal.QuotedExpr_unseal(expr)
426426

427427
/** Checked cast to a `quoted.Expr[U]` */
428-
def cast[U: scala.quoted.Type](given ctx: Context): scala.quoted.Expr[U] =
428+
def cast[U](given tp: scala.quoted.Type[U], ctx: Context): scala.quoted.Expr[U] =
429429
internal.QuotedExpr_cast[U](expr)
430430
}
431431

432-
implicit class QuotedTypeAPI[T <: AnyKind](tpe: scala.quoted.Type[T]) {
432+
given QuotedTypeAPI: extension [T <: AnyKind](tpe: scala.quoted.Type[T]) {
433433
/** View this expression `quoted.Type[T]` as a `TypeTree` */
434434
def unseal(given ctx: Context): TypeTree =
435435
internal.QuotedType_unseal(tpe)
436436
}
437437

438-
implicit class TermToQuotedAPI(term: Term) {
438+
given TermToQuotedOps: extension (term: Term) {
439439
/** Convert `Term` to an `quoted.Expr[Any]` */
440440
def seal(given ctx: Context): scala.quoted.Expr[Any] =
441441
internal.QuotedExpr_seal(term)
442442
}
443443

444-
implicit class TypeToQuotedAPI(tpe: Type) {
445-
/** Convert `Type` to an `quoted.Type[_]` */
446-
def seal(given ctx: Context): scala.quoted.Type[_] =
447-
internal.QuotedType_seal(tpe)
444+
given TypeToQuotedOps: extension (tpe: Type) {
445+
/** Convert `Type` to an `quoted.Type[_]` */
446+
def seal(given ctx: Context): scala.quoted.Type[_] =
447+
internal.QuotedType_seal(tpe)
448448
}
449449

450450
//////////////

0 commit comments

Comments
 (0)