@@ -419,29 +419,29 @@ 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 ) {
444+ given TypeToQuotedOps : extension (tpe : Type ) {
445445 /** Convert `Type` to an `quoted.Type[_]` */
446446 def seal (given ctx : Context ): scala.quoted.Type [_] =
447447 internal.QuotedType_seal (tpe)
@@ -452,7 +452,7 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
452452 // ////////////
453453
454454 /** Context of the macro expansion */
455- implicit def rootContext : Context = internal.rootContext // TODO: Use given // TODO: Should this be moved to QuoteContext?
455+ given rootContext : Context = internal.rootContext // TODO: Use given // TODO: Should this be moved to QuoteContext?
456456
457457 given ContextOps : extension (self : Context ) {
458458 /** Returns the owner of the context */
@@ -1009,7 +1009,7 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
10091009 case _ => None
10101010 }
10111011
1012- def apply (tpe : MethodType , rhsFn : List [Tree ] => Tree )(implicit ctx : Context ): Block =
1012+ def apply (tpe : MethodType , rhsFn : List [Tree ] => Tree )(given ctx : Context ): Block =
10131013 internal.Lambda_apply (tpe, rhsFn)
10141014
10151015 }
@@ -2785,16 +2785,20 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
27852785 case Inlined (call, bindings, expansion) =>
27862786 foldTree(foldTrees(x, bindings), expansion)
27872787 case vdef @ ValDef (_, tpt, rhs) =>
2788- implicit val ctx = localCtx(vdef)
2788+ val ctx = localCtx(vdef)
2789+ given Context = ctx
27892790 foldTrees(foldTree(x, tpt), rhs)
27902791 case ddef @ DefDef (_, tparams, vparamss, tpt, rhs) =>
2791- implicit val ctx = localCtx(ddef)
2792+ val ctx = localCtx(ddef)
2793+ given Context = ctx
27922794 foldTrees(foldTree(vparamss.foldLeft(foldTrees(x, tparams))(foldTrees), tpt), rhs)
27932795 case tdef @ TypeDef (_, rhs) =>
2794- implicit val ctx = localCtx(tdef)
2796+ val ctx = localCtx(tdef)
2797+ given Context = ctx
27952798 foldTree(x, rhs)
27962799 case cdef @ ClassDef (_, constr, parents, derived, self, body) =>
2797- implicit val ctx = localCtx(cdef)
2800+ val ctx = localCtx(cdef)
2801+ given Context = ctx
27982802 foldTrees(foldTrees(foldTrees(foldTrees(foldTree(x, constr), parents), derived), self), body)
27992803 case Import (expr, _) =>
28002804 foldTree(x, expr)
@@ -2867,15 +2871,18 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
28672871 case tree : Term =>
28682872 transformTerm(tree)
28692873 case tree : ValDef =>
2870- implicit val ctx = localCtx(tree)
2874+ val ctx = localCtx(tree)
2875+ given Context = ctx
28712876 val tpt1 = transformTypeTree(tree.tpt)
28722877 val rhs1 = tree.rhs.map(x => transformTerm(x))
28732878 ValDef .copy(tree)(tree.name, tpt1, rhs1)
28742879 case tree : DefDef =>
2875- implicit val ctx = localCtx(tree)
2880+ val ctx = localCtx(tree)
2881+ given Context = ctx
28762882 DefDef .copy(tree)(tree.name, transformSubTrees(tree.typeParams), tree.paramss mapConserve (transformSubTrees(_)), transformTypeTree(tree.returnTpt), tree.rhs.map(x => transformTerm(x)))
28772883 case tree : TypeDef =>
2878- implicit val ctx = localCtx(tree)
2884+ val ctx = localCtx(tree)
2885+ given Context = ctx
28792886 TypeDef .copy(tree)(tree.name, transformTree(tree.rhs))
28802887 case tree : ClassDef =>
28812888 ClassDef .copy(tree)(tree.name, tree.constructor, tree.parents, tree.derived, tree.self, tree.body)
0 commit comments