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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+7-7
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

+1-1
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

+22-22
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

+1-1
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$")

tests/neg-macros/quote-error-2/Macro_1.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import quoted._
22

33
object Macro_1 {
44
inline def foo(inline b: Boolean): Unit = ${ fooImpl('b) }
5-
def fooImpl(b: Expr[Boolean]) with QuoteContext: Expr[Unit] =
5+
def fooImpl(b: Expr[Boolean])(using QuoteContext): Expr[Unit] =
66
'{println(${msg(b.value)})}
77

8-
def msg(b: Boolean) with (qctx: QuoteContext) : Expr[String] =
8+
def msg(b: Boolean)(using qctx: QuoteContext): Expr[String] =
99
if (b) '{"foo(true)"}
1010
else { qctx.error("foo cannot be called with false"); '{ ??? } }
1111

tests/neg-macros/quote-error/Macro_1.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import quoted._
22

33
object Macro_1 {
44
inline def foo(inline b: Boolean): Unit = ${fooImpl('b)}
5-
def fooImpl(b: Expr[Boolean]) with (qctx: QuoteContext) : Expr[Unit] =
5+
def fooImpl(b: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] =
66
if (b.value) '{println("foo(true)")}
77
else { qctx.error("foo cannot be called with false"); '{ ??? } }
88
}

tests/neg-macros/quote-exception/Macro_1.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import quoted._
22

33
object Macro_1 {
44
inline def foo(inline b: Boolean): Unit = ${fooImpl('b)}
5-
def fooImpl(b: Expr[Boolean]) with QuoteContext : Expr[Unit] =
5+
def fooImpl(b: Expr[Boolean]) (using QuoteContext): Expr[Unit] =
66
if (b.value) '{println("foo(true)")}
77
else ???
88
}

tests/neg-macros/quote-whitebox/Macro_1.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import scala.quoted._
22

33
object Macros {
44
inline def defaultOf(inline str: String) <: Any = ${ defaultOfImpl('str) }
5-
def defaultOfImpl(str: Expr[String]) with QuoteContext : Expr[Any] = str.value match {
5+
def defaultOfImpl(str: Expr[String]) (using QuoteContext): Expr[Any] = str.value match {
66
case "int" => '{1}
77
case "string" => '{"a"}
88
}

tests/neg-macros/tasty-macro-assert-1/quoted_1.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ object Asserts {
1212
inline def macroAssert(inline cond: Boolean): Unit =
1313
${impl('cond)}
1414

15-
def impl(cond: Expr[Boolean]) with (qctx: QuoteContext) : Expr[Unit] = {
15+
def impl(cond: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] = {
1616
import qctx.tasty.{_, given _}
1717

1818
val tree = cond.unseal

tests/neg-macros/tasty-macro-assert-2/quoted_1.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ object Asserts {
1212
inline def macroAssert(inline cond: Boolean): Unit =
1313
${ impl('cond) }
1414

15-
def impl(cond: Expr[Boolean]) with (qctx: QuoteContext) : Expr[Unit] = {
15+
def impl(cond: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] = {
1616
import qctx.tasty.{_, given _}
1717

1818
val tree = cond.unseal

tests/neg-macros/tasty-macro-error/quoted_1.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ object Macros {
44

55
inline def fun(x: Any): Unit = ${ impl('x) }
66

7-
def impl(x: Expr[Any]) with (qctx: QuoteContext) : Expr[Unit] = {
7+
def impl(x: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = {
88
import qctx.tasty.{_, given _}
99
error("here is the the argument is " + x.unseal.underlyingArgument.show, x.unseal.underlyingArgument.pos)
1010
'{}

tests/neg-macros/tasty-macro-positions/quoted_1.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ object Macros {
44

55
inline def fun(x: Any): Unit = ${ impl('x) }
66

7-
def impl(x: Expr[Any]) with (qctx: QuoteContext) : Expr[Unit] = {
7+
def impl(x: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = {
88
import qctx.tasty.{_, given _}
99
val pos = x.unseal.underlyingArgument.pos
1010
error("here is the the argument is " + x.unseal.underlyingArgument.show, pos)

tests/neg-macros/tasty-string-interpolator-position-a/Macro_1.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ object Macro {
99

1010
object FIntepolator {
1111

12-
def apply(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]]) with (qctx: QuoteContext) : Expr[String] = {
12+
def apply(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using qctx: QuoteContext) : Expr[String] = {
1313
import qctx.tasty.{_, given _}
1414
error("there are no parts", strCtxExpr.unseal.underlyingArgument.pos)
1515
'{ ($strCtxExpr).s($argsExpr: _*) }

tests/neg-macros/tasty-string-interpolator-position-b/Macro_1.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ object Macro {
88
}
99

1010
object FIntepolator {
11-
def apply(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]]) with (qctx: QuoteContext) : Expr[String] = {
11+
def apply(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using qctx: QuoteContext) : Expr[String] = {
1212
import qctx.tasty.{_, given _}
1313
error("there are no args", argsExpr.unseal.underlyingArgument.pos)
1414
'{ ($strCtxExpr).s($argsExpr: _*) }

tests/neg/given-eta.scala

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ trait D
33
type T
44
def trans(other: T): T
55

6-
def h(d: D) with (x: d.T) (y: d.T) = (d.trans(x), d.trans(y))
6+
def h(d: D)(using x: d.T)(y: d.T) = (d.trans(x), d.trans(y))
77

88
val z = h // error: no implicit argument of type d.T was found for parameter x of method h
99

10-
def f with (D) (x: Int) = x // OK
11-
def g with D (x: Int) = x // error // error
10+
def f(using D)(x: Int) = x // OK

tests/neg/i7048e.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ abstract class Test {
77
val getT: Type[T] = T // need this to avoid getting `null`
88
given Type[T] = getT
99

10-
def foo with QuoteContext: Expr[Any] = {
10+
def foo(using QuoteContext): Expr[Any] = {
1111

1212
val r = '{Option.empty[T]} // error
1313

tests/neg/i7425.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class C { def f: Int = 0 }
22

33
trait D { def f(): Int = 0 }
44

5-
def foo1(x: C & D) = x.f // error: method f must be called with () argument
5+
def foo1(x: C & D) = x.f // error: method f must be called(using ) argument
66
def foo2(x: C | D) = x.f // error: value f is not a member of C | D
77
def foo3(x: D & C) = x.f // ok
88
def foo4(x: D | C) = x.f // error: value f is not a member of D | C

tests/neg/i7919.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import scala.quoted._
22

33
object Test {
4-
def staged[T] with (qctx: QuoteContext) = {
4+
def staged[T](using qctx: QuoteContext) = {
55
import qctx.tasty.{_, given _}
66
given typeT as quoted.Type[T] // error
77
val tTypeTree = typeT.unseal

tests/neg/implicit-params.scala

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ object Test {
33
case class C(x: Int)
44
case class D(x: Int)
55

6-
def f(x: Int) with (c: C) = x + c.x
6+
def f(x: Int)(using c: C) = x + c.x
77

8-
def g0(x: Int) with (c: C) (y: Int) = x + c.x + y
8+
def g0(x: Int)(using c: C) (y: Int) = x + c.x + y
99

10-
def g(x: Int) with (c: C) with D = x + c.x + summon[D].x // OK
10+
def g(x: Int)(using c: C)(using D) = x + c.x + summon[D].x // OK
1111

1212
def h(x: Int) given () = x // error: missing return type
1313

1414
given C as C(11)
1515
given D as D(11)
1616

1717
f(1)
18-
f(1).with(C)
19-
f.with(2) // error
18+
f(1)(using C)
19+
f(using 2) // error
2020
f(1)(C) // error
2121

2222
g(1) // OK
23-
g(1).with(C) // OK
24-
g(1).with(C).with(D(0)) // OK
25-
g(1).with(D) // error
23+
g(1)(using C) // OK
24+
g(1)(using C)(using D(0)) // OK
25+
g(1)(using D) // error
2626
g(1)(D) // error
2727
g(1)(C)(D) // error
2828
}

tests/pending/run/tasty-comments/quoted_1.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ object Macros {
77
inline def printComment[T](t: => T): Unit =
88
${ impl('t) }
99

10-
def impl[T](x: Expr[T]) with (qctx: QuoteContext) : Expr[Unit] = {
10+
def impl[T](x: Expr[T])(using qctx: QuoteContext) : Expr[Unit] = {
1111
import qctx.tasty.{_, given _}
1212

1313
val tree = x.unseal

tests/pos-custom-args/erased/i7868.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ object Coproduct {
1515
def cast: Head <:< Head +: Tail = summon[Head <:< Head +: Tail]
1616
}
1717

18-
given atTail[Head, Tail, Value, NextIndex <: Int] with (atNext: At[Tail, Value, NextIndex]) : At[Head +: Tail, Value, S[NextIndex]] {
18+
given atTail[Head, Tail, Value, NextIndex <: Int](using atNext: At[Tail, Value, NextIndex]) as At[Head +: Tail, Value, S[NextIndex]] {
1919
val cast: Value <:< Head +: Tail = atNext.cast
2020
}
2121

22-
given [A] with A as (() => A)= { () => summon[A]}
22+
given [A](using A) as (() => A)= { () => summon[A]}
2323
}
2424

25-
def upCast[A, B](a: A) with (erased evidence: (A <:< B) ): B = a.asInstanceOf[B]
25+
def upCast[A, B](a: A)(using erased evidence: (A <:< B) ): B = a.asInstanceOf[B]
2626

27-
def from[Set, Value, Index <: Int](value: Value) with (erased at: At[Set, Value, Index]) : ValueOf[Index] ?=> Coproduct[Set, Value, Index] = {
28-
Coproduct[Set, Value, Index](upCast(value: Value).with(at.cast.liftCo[[X] =>> Value & X]), valueOf[Index])
27+
def from[Set, Value, Index <: Int](value: Value)(using erased at: At[Set, Value, Index]) : ValueOf[Index] ?=> Coproduct[Set, Value, Index] = {
28+
Coproduct[Set, Value, Index](upCast(value: Value)(using at.cast.liftCo[[X] =>> Value & X]), valueOf[Index])
2929
}
3030

3131
}

tests/pos-macros/i6171/Macro_1.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ object scalatest {
44

55
inline def assert(x: => Any): Unit = ${ assertImpl('x) }
66

7-
def assertImpl(x: Expr[Any]) with (qctx: QuoteContext) : Expr[Unit] = {
7+
def assertImpl(x: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = {
88
import qctx.tasty.{_, given _}
99
x.unseal.underlyingArgument
1010
'{ () }

0 commit comments

Comments
 (0)