Skip to content

Commit 9e86124

Browse files
committed
Partial comversion to using clauses
Convert all files that had a conflict in the last commit, which reverted `with` clauses to `given` parameters.
1 parent ad66401 commit 9e86124

File tree

132 files changed

+260
-261
lines changed

Some content is hidden

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

132 files changed

+260
-261
lines changed

tests/neg-macros/delegate-match-1/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import scala.quoted.matching._
33

44
inline def f: Any = ${ fImpl }
55

6-
private def fImpl with (qctx: QuoteContext) : Expr[Unit] = {
6+
private def fImpl (using qctx: QuoteContext) : Expr[Unit] = {
77
import qctx.tasty.{_, given _}
88
searchImplicit(('[A]).unseal.tpe) match {
99
case x: ImplicitSearchSuccess =>

tests/neg-macros/delegate-match-2/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import scala.quoted.matching._
33

44
inline def f: Any = ${ fImpl }
55

6-
private def fImpl with (qctx: QuoteContext) : Expr[Unit] = {
6+
private def fImpl (using qctx: QuoteContext) : Expr[Unit] = {
77
import qctx.tasty.{_, given _}
88
searchImplicit(('[A]).unseal.tpe) match {
99
case x: ImplicitSearchSuccess =>

tests/neg-macros/delegate-match-3/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import scala.quoted.matching._
33

44
inline def f: Any = ${ fImpl }
55

6-
private def fImpl with (qctx: QuoteContext) : Expr[Unit] = {
6+
private def fImpl(using qctx: QuoteContext) : Expr[Unit] = {
77
import qctx.tasty.{_, given _}
88
searchImplicit(('[A]).unseal.tpe) match {
99
case x: ImplicitSearchSuccess =>

tests/neg-macros/i6432/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import scala.quoted.matching._
66
object Macro {
77
inline def (sc: => StringContext).foo(args: String*): Unit = ${ impl('sc) }
88

9-
def impl(sc: Expr[StringContext]) with (qctx: QuoteContext) : Expr[Unit] = {
9+
def impl(sc: Expr[StringContext])(using qctx: QuoteContext) : Expr[Unit] = {
1010
import qctx.tasty.{_, given _}
1111
sc match {
1212
case '{ StringContext(${ExprSeq(parts)}: _*) } =>

tests/neg-macros/i6432b/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import scala.quoted.matching._
66
object Macro {
77
inline def (sc: => StringContext).foo(args: String*): Unit = ${ impl('sc) }
88

9-
def impl(sc: Expr[StringContext]) with (qctx: QuoteContext) : Expr[Unit] = {
9+
def impl(sc: Expr[StringContext])(using qctx: QuoteContext) : Expr[Unit] = {
1010
import qctx.tasty.{_, given _}
1111
sc match {
1212
case '{ StringContext(${ExprSeq(parts)}: _*) } =>

tests/neg-macros/i6976/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import scala.tasty._
77
object macros {
88
inline def mcr(x: => Any) = ${mcrImpl('x)}
99

10-
def mcrImpl(body: Expr[Any]) with (ctx: QuoteContext) : Expr[Any] = {
10+
def mcrImpl(body: Expr[Any])(using ctx: QuoteContext) : Expr[Any] = {
1111
import ctx.tasty.{_, given _}
1212
body.unseal match { case Block(_, _) => '{2} }
1313
}

tests/neg-macros/inline-macro-staged-interpreter/Macro_1.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ object E {
77

88
inline def eval[T](inline x: E[T]): T = ${ impl('x) }
99

10-
def impl[T: Type](x: Expr[E[T]]) with QuoteContext : Expr[T] = x.value.lift
10+
def impl[T: Type](x: Expr[E[T]]) (using QuoteContext): Expr[T] = x.value.lift
1111

1212
implicit def ev1[T: Type]: ValueOfExpr[E[T]] = new ValueOfExpr {
13-
def apply(x: Expr[E[T]]) with QuoteContext : Option[E[T]] = x match {
13+
def apply(x: Expr[E[T]]) (using QuoteContext): Option[E[T]] = x match {
1414
case '{ I(${Const(n)}) } => Some(I(n).asInstanceOf[E[T]])
1515
case '{ Plus[T](${Value(x)}, ${Value(y)})(given $op) } if op.matches('{Plus2.IPlus}) => Some(Plus(x, y)(given Plus2.IPlus.asInstanceOf[Plus2[T]]).asInstanceOf[E[T]])
1616
case _ => None
@@ -23,24 +23,24 @@ object E {
2323
}
2424

2525
trait E[T] {
26-
def lift with QuoteContext : Expr[T]
26+
def lift (using QuoteContext): Expr[T]
2727
}
2828

2929
case class I(n: Int) extends E[Int] {
30-
def lift with QuoteContext : Expr[Int] = n
30+
def lift (using QuoteContext): Expr[Int] = n
3131
}
3232

3333
case class Plus[T](x: E[T], y: E[T])(implicit op: Plus2[T]) extends E[T] {
34-
def lift with QuoteContext : Expr[T] = op(x.lift, y.lift)
34+
def lift (using QuoteContext): Expr[T] = op(x.lift, y.lift)
3535
}
3636

3737
trait Op2[T] {
38-
def apply(x: Expr[T], y: Expr[T]) with QuoteContext : Expr[T]
38+
def apply(x: Expr[T], y: Expr[T]) (using QuoteContext): Expr[T]
3939
}
4040

4141
trait Plus2[T] extends Op2[T]
4242
object Plus2 {
4343
implicit case object IPlus extends Plus2[Int] {
44-
def apply(x: Expr[Int], y: Expr[Int]) with QuoteContext : Expr[Int] = '{$x + $y}
44+
def apply(x: Expr[Int], y: Expr[Int]) (using QuoteContext): Expr[Int] = '{$x + $y}
4545
}
4646
}

tests/neg-macros/inline-option/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import scala.quoted._
33

44
object Macro {
5-
def impl(opt: Expr[Option[Int]]) with QuoteContext : Expr[Int] = opt.value match {
5+
def impl(opt: Expr[Option[Int]]) (using QuoteContext): Expr[Int] = opt.value match {
66
case Some(i) => Expr(i)
77
case None => '{-1}
88
}

tests/neg-macros/inline-tuples-1/Macro_1.scala

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ import scala.quoted._
33
import scala.quoted.autolift.{given _}
44

55
object Macros {
6-
def tup1(tup: Expr[Tuple1[Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
7-
def tup2(tup: Expr[Tuple2[Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
8-
def tup3(tup: Expr[Tuple3[Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
9-
def tup4(tup: Expr[Tuple4[Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
10-
def tup5(tup: Expr[Tuple5[Int, Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
11-
def tup6(tup: Expr[Tuple6[Int, Int, Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
12-
def tup7(tup: Expr[Tuple7[Int, Int, Int, Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
13-
def tup8(tup: Expr[Tuple8[Int, Int, Int, Int, Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
14-
def tup9(tup: Expr[Tuple9[Int, Int, Int, Int, Int, Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
15-
def tup10(tup: Expr[Tuple10[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
16-
def tup11(tup: Expr[Tuple11[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
17-
def tup12(tup: Expr[Tuple12[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
18-
def tup13(tup: Expr[Tuple13[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
19-
def tup14(tup: Expr[Tuple14[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
20-
def tup15(tup: Expr[Tuple15[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
21-
def tup16(tup: Expr[Tuple16[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
22-
def tup17(tup: Expr[Tuple17[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
23-
def tup18(tup: Expr[Tuple18[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
24-
def tup19(tup: Expr[Tuple19[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
25-
def tup20(tup: Expr[Tuple20[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
26-
def tup21(tup: Expr[Tuple21[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
27-
def tup22(tup: Expr[Tuple22[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) with QuoteContext : Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
6+
def tup1(tup: Expr[Tuple1[Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
7+
def tup2(tup: Expr[Tuple2[Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
8+
def tup3(tup: Expr[Tuple3[Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
9+
def tup4(tup: Expr[Tuple4[Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
10+
def tup5(tup: Expr[Tuple5[Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
11+
def tup6(tup: Expr[Tuple6[Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
12+
def tup7(tup: Expr[Tuple7[Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
13+
def tup8(tup: Expr[Tuple8[Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
14+
def tup9(tup: Expr[Tuple9[Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
15+
def tup10(tup: Expr[Tuple10[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
16+
def tup11(tup: Expr[Tuple11[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
17+
def tup12(tup: Expr[Tuple12[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
18+
def tup13(tup: Expr[Tuple13[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
19+
def tup14(tup: Expr[Tuple14[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
20+
def tup15(tup: Expr[Tuple15[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
21+
def tup16(tup: Expr[Tuple16[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
22+
def tup17(tup: Expr[Tuple17[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
23+
def tup18(tup: Expr[Tuple18[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
24+
def tup19(tup: Expr[Tuple19[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
25+
def tup20(tup: Expr[Tuple20[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
26+
def tup21(tup: Expr[Tuple21[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
27+
def tup22(tup: Expr[Tuple22[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
2828
}

tests/neg-macros/macros-in-same-project-6/Foo.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ object Foo {
44

55
inline def myMacro(): Unit = ${ aMacroImplementation }
66

7-
def aMacroImplementation with (qctx: QuoteContext) : Expr[Unit] = {
7+
def aMacroImplementation(using qctx: QuoteContext) : Expr[Unit] = {
88
import qctx.tasty.{given, _}
99
error("some error", rootPosition)
1010
throw new NoClassDefFoundError("Bar$")

0 commit comments

Comments
 (0)