Skip to content

Commit bfb88cc

Browse files
committed
Go back to (given ... parameters and arguments
This reverts commit 04095bc. # Conflicts: # compiler/src/dotty/tools/dotc/parsing/Parsers.scala # compiler/src/dotty/tools/dotc/parsing/Tokens.scala # docs/docs/internals/syntax.md # tests/neg-macros/delegate-match-1/Macro_1.scala # tests/neg-macros/delegate-match-2/Macro_1.scala # tests/neg-macros/delegate-match-3/Macro_1.scala # tests/neg-macros/i6432/Macro_1.scala # tests/neg-macros/i6432b/Macro_1.scala # tests/neg-macros/i6976/Macro_1.scala # tests/neg-macros/inline-case-objects/Macro_1.scala # tests/neg-macros/inline-macro-staged-interpreter/Macro_1.scala # tests/neg-macros/inline-option/Macro_1.scala # tests/neg-macros/inline-tuples-1/Macro_1.scala # tests/neg-macros/macros-in-same-project-6/Foo.scala # tests/neg-macros/quote-error-2/Macro_1.scala # tests/neg-macros/quote-error/Macro_1.scala # tests/neg-macros/quote-exception/Macro_1.scala # tests/neg-macros/quote-whitebox/Macro_1.scala # tests/neg-macros/reflect-inline/assert_1.scala # tests/neg-macros/tasty-macro-assert-1/quoted_1.scala # tests/neg-macros/tasty-macro-assert-2/quoted_1.scala # tests/neg-macros/tasty-macro-error/quoted_1.scala # tests/neg-macros/tasty-macro-positions/quoted_1.scala # tests/neg-macros/tasty-string-interpolator-position-a/Macro_1.scala # tests/neg-macros/tasty-string-interpolator-position-b/Macro_1.scala # tests/neg/given-eta.scala # tests/neg/i7919.scala # tests/neg/implicit-params.scala # tests/pending/run/tasty-comments/quoted_1.scala # tests/pos-custom-args/erased/i7868.scala # tests/pos-macros/i6171/Macro_1.scala # tests/pos-macros/i6535/Macro_1.scala # tests/pos-macros/i6803b/Macro_1.scala # tests/pos-macros/i7011/Macros_1.scala # tests/pos-macros/quote-nested-object/Macro_1.scala # tests/pos-macros/quote-whitebox-2/Macro_1.scala # tests/pos-macros/tasty-constant-type/Macro_1.scala # tests/pos-macros/treemap-unapply/Macro.scala # tests/pos/i7204.scala # tests/pos/i7532.scala # tests/run-custom-args/Yretain-trees/tasty-definitions-2/Macro_1.scala # tests/run-custom-args/Yretain-trees/tasty-definitions-3/Macro_1.scala # tests/run-custom-args/Yretain-trees/tasty-extractors-owners/quoted_1.scala # tests/run-custom-args/Yretain-trees/tasty-load-tree-1/quoted_1.scala # tests/run-custom-args/Yretain-trees/tasty-load-tree-2/quoted_1.scala # tests/run-custom-args/run-macros-erased/reflect-isFunctionType/macro_1.scala # tests/run-macros/f-interpolation-1/FQuote_1.scala # tests/run-macros/gestalt-type-toolbox-reflect/Macro_1.scala # tests/run-macros/i4735/Macro_1.scala # tests/run-macros/i4803/Macro_1.scala # tests/run-macros/i4803b/Macro_1.scala # tests/run-macros/i4803c/Macro_1.scala # tests/run-macros/i5119/Macro_1.scala # tests/run-macros/i5119b/Macro_1.scala # tests/run-macros/i5188a/Macro_1.scala # tests/run-macros/i5533/Macro_1.scala # tests/run-macros/i5533b/Macro_1.scala # tests/run-macros/i5536/Macro_1.scala # tests/run-macros/i5629/Macro_1.scala # tests/run-macros/i5715/Macro_1.scala # tests/run-macros/i5941/macro_1.scala # tests/run-macros/i6171/Macro_1.scala # tests/run-macros/i6270/Macro_1.scala # tests/run-macros/i6518/Macro_1.scala # tests/run-macros/i6679/Macro_1.scala # tests/run-macros/i6765-c/Macro_1.scala # tests/run-macros/i6765/Macro_1.scala # tests/run-macros/i6988/FirstArg_1.scala # tests/run-macros/i7898/Macro_1.scala # tests/run-macros/i7964/Macro_1.scala # tests/run-macros/inferred-repeated-result/test_1.scala # tests/run-macros/inline-case-objects/Macro_1.scala # tests/run-macros/inline-macro-staged-interpreter/Macro_1.scala # tests/run-macros/inline-option/Macro_1.scala # tests/run-macros/inline-tuples-1/Macro_1.scala # tests/run-macros/inline-tuples-2/Macro_1.scala # tests/run-macros/inline-varargs-1/Macro_1.scala # tests/run-macros/quote-and-splice/Macros_1.scala # tests/run-macros/quote-inline-function/quoted_1.scala # tests/run-macros/quote-matcher-power/Macro_1.scala # tests/run-macros/quote-matcher-runtime/quoted_1.scala # tests/run-macros/quote-simple-macro/quoted_1.scala # tests/run-macros/quote-toExprOfTuple/Macro_1.scala # tests/run-macros/quote-type-matcher/quoted_1.scala # tests/run-macros/quote-whitebox/Macro_1.scala # tests/run-macros/quoted-expr-block/quoted_1.scala # tests/run-macros/quoted-matching-docs/Macro_1.scala # tests/run-macros/refined-selectable-macro/Macro_1.scala # tests/run-macros/reflect-dsl/assert_1.scala # tests/run-macros/reflect-inline/assert_1.scala # tests/run-macros/reflect-lambda/assert_1.scala # tests/run-macros/reflect-pos-fun/assert_1.scala # tests/run-macros/reflect-select-constructor/assert_1.scala # tests/run-macros/reflect-select-copy-2/assert_1.scala # tests/run-macros/reflect-select-copy/assert_1.scala # tests/run-macros/reflect-select-symbol-constructor/assert_1.scala # tests/run-macros/reflect-select-value-class/assert_1.scala # tests/run-macros/reflect-typeChecks/assert_1.scala # tests/run-macros/requiredSymbols/Macro_1.scala # tests/run-macros/tasty-argument-tree-1/quoted_1.scala # tests/run-macros/tasty-custom-show/quoted_1.scala # tests/run-macros/tasty-dealias/quoted_1.scala # tests/run-macros/tasty-definitions-1/quoted_1.scala # tests/run-macros/tasty-eval/quoted_1.scala # tests/run-macros/tasty-extractors-1/quoted_1.scala # tests/run-macros/tasty-extractors-2/quoted_1.scala # tests/run-macros/tasty-extractors-3/quoted_1.scala # tests/run-macros/tasty-extractors-types/quoted_1.scala # tests/run-macros/tasty-getfile/Macro_1.scala # tests/run-macros/tasty-interpolation-1/Macro.scala # tests/run-macros/tasty-linenumber-2/quoted_1.scala # tests/run-macros/tasty-linenumber/quoted_1.scala # tests/run-macros/tasty-location/quoted_1.scala # tests/run-macros/tasty-macro-assert/quoted_1.scala # tests/run-macros/tasty-macro-const/quoted_1.scala # tests/run-macros/tasty-macro-positions/quoted_1.scala # tests/run-macros/tasty-original-source/Macros_1.scala # tests/run-macros/tasty-seal-method/quoted_1.scala # tests/run-macros/tasty-simplified/quoted_1.scala # tests/run-macros/tasty-subtyping/quoted_1.scala # tests/run-macros/tasty-tree-map/quoted_1.scala # tests/run-macros/tasty-typeof/Macro_1.scala # tests/run-macros/tasty-unsafe-let/quoted_1.scala # tests/run-macros/type-show/Macro_1.scala # tests/run-macros/xml-interpolation-1/XmlQuote_1.scala # tests/run-macros/xml-interpolation-2/XmlQuote_1.scala # tests/run-macros/xml-interpolation-3/XmlQuote_1.scala # tests/run-with-compiler/i6201/macro_1.scala # tests/run/given-eta.scala
1 parent 54f0a85 commit bfb88cc

File tree

344 files changed

+734
-732
lines changed

Some content is hidden

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

344 files changed

+734
-732
lines changed

tests/disabled/neg-with-compiler/quote-run-in-macro-2/quoted_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import scala.quoted.autolift.{given _}
44
object Macros {
55

66
inline def foo(i: => Int): Int = ${ fooImpl('i) }
7-
def fooImpl(i: Expr[Int]) with QuoteContext : Expr[Int] = {
7+
def fooImpl(i: Expr[Int])(given QuoteContext): Expr[Int] = {
88
given Toolbox = Toolbox.make(getClass.getClassLoader)
99
val y: Int = run(i)
1010
y

tests/disabled/reflect/run/t3425b/Base_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ object Gen {
2626
}
2727
case class Pair(tp1: Tp, tp2: Tp) {
2828
def expr = s"((new ABC): $tp)"
29-
def tp = s"($tp1) with $tp2"
29+
def tp = s"($tp1) with ($tp2)"
3030
}
3131
val traits = Vector("Any", "A", "B", "C") map ("%6s" format _)
3232
val types = Vector("P", "Q", "R forSome { type R <: P with Q }")
@@ -39,7 +39,7 @@ object Gen {
3939
import p._
4040
List(
4141
s"type R1_$idx = $tp",
42-
s"type R2_$idx = R1_$idx { val y: (${tp1.elem}) with ${tp2.elem} }"
42+
s"type R2_$idx = R1_$idx { val y: (${tp1.elem}) with (${tp2.elem}) }"
4343
)
4444
}
4545

tests/generic-java-signatures/i3653.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class Foo {
55
c0: T, c1: T, c2: T, c3: T, c4: T, c5: T, c6: T, c7: T, c8: T, c9: T) => 0
66

77
// #6946
8-
def baz = (x: String ?=> Unit) => x.with("")
8+
def baz = (x: String ?=> Unit) => x(given "")
99
}
1010

1111
object Test {

tests/neg-custom-args/fatal-warnings/quote-simple-hole.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import scala.quoted.QuoteContext
22

3-
def test with QuoteContext = {
3+
def test(given QuoteContext) = {
44
val x = '{0}
55
val y = '{ // error: Canceled splice directly inside a quote. '{ ${ XYZ } } is equivalent to XYZ.
66
$x

tests/neg-macros/GenericNumLits/Even_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ object Even {
1111
else throw FromDigits.MalformedNumber(s"$digits is odd")
1212
}
1313

14-
private def evenFromDigitsImpl(digits: Expr[String]) with (ctx: QuoteContext) : Expr[Even] = digits match {
14+
private def evenFromDigitsImpl(digits: Expr[String])(given ctx: QuoteContext): Expr[Even] = digits match {
1515
case Const(ds) =>
1616
val ev =
1717
try evenFromDigits(ds)

tests/neg-macros/macro-class-not-found-1/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 QuoteContext : Expr[Unit] =
7+
def aMacroImplementation(given QuoteContext): Expr[Unit] =
88
throw new NoClassDefFoundError()
99

1010
}

tests/neg-macros/macro-class-not-found-2/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 QuoteContext : Expr[Unit] =
7+
def aMacroImplementation(given QuoteContext): Expr[Unit] =
88
throw new NoClassDefFoundError("this.is.not.a.Class")
99

1010
}

tests/neg-macros/macros-in-same-project-1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ object Bar {
77

88
inline def myMacro(): Unit = ${ aMacroImplementation }
99

10-
def aMacroImplementation with QuoteContext : Expr[Unit] = '{}
10+
def aMacroImplementation(given QuoteContext): Expr[Unit] = '{}
1111

1212
}

tests/neg-macros/macros-in-same-project-2.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ object Bar {
88
inline def myMacro(): Unit = myMacro2()
99
inline def myMacro2(): Unit = ${ aMacroImplementation }
1010

11-
def aMacroImplementation with QuoteContext : Expr[Unit] = '{}
11+
def aMacroImplementation(given QuoteContext): Expr[Unit] = '{}
1212

1313
}

tests/neg-macros/macros-in-same-project-4/Bar.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ object Bar {
55

66
Foo.myMacro()
77

8-
def hello() with QuoteContext : Expr[Unit] = '{ println("Hello") }
8+
def hello()(given QuoteContext): Expr[Unit] = '{ println("Hello") }
99
}

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

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

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

7-
def aMacroImplementation with QuoteContext : Expr[Unit] = Bar.hello()
7+
def aMacroImplementation(given QuoteContext): Expr[Unit] = Bar.hello()
88

99
}

tests/neg-macros/macros-in-same-project-5/Bar.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ object Bar {
44

55
Foo.myMacro() // error
66

7-
def aMacroImplementation with QuoteContext : Expr[Unit] = Bar.hello()
7+
def aMacroImplementation(given QuoteContext): Expr[Unit] = Bar.hello()
88

9-
def hello() with QuoteContext : Expr[Unit] = '{ println("Hello") }
9+
def hello()(given QuoteContext): Expr[Unit] = '{ println("Hello") }
1010
}

tests/neg-macros/quote-complex-top-splice.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ object Test {
2828
impl(1)
2929
}
3030

31-
def impl(i: Int) with QuoteContext : Expr[Unit] = '{}
31+
def impl(i: Int)(given QuoteContext): Expr[Unit] = '{}
3232

3333
}

tests/neg-macros/quote-interpolator-core-old.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ object FInterpolation {
1212
// ...
1313
}
1414

15-
private def liftSeq(args: Seq[Expr[Any]]) with QuoteContext : Expr[Seq[Any]] = args match {
15+
private def liftSeq(args: Seq[Expr[Any]])(given QuoteContext): Expr[Seq[Any]] = args match {
1616
case x :: xs => '{ ($x) +: ${liftSeq(xs)} }
1717
case Nil => '{Seq(): Seq[Any]}
1818
}
1919

20-
def fInterpolation(sc: StringContext, args: Seq[Expr[Any]]) with QuoteContext : Expr[String] = {
20+
def fInterpolation(sc: StringContext, args: Seq[Expr[Any]])(given QuoteContext): Expr[String] = {
2121
val str: Expr[String] = sc.parts.mkString("")
2222
val args1: Expr[Seq[Any]] = liftSeq(args)
2323
'{ $str.format($args1: _*) }

tests/neg-macros/quote-macro-complex-arg-0.scala

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

33
object Macros {
44
inline def foo(inline i: Int, dummy: Int, j: Int): Int = ${ bar(i + 1, 'j) } // error: i + 1 is not a parameter or field reference
5-
def bar(x: Int, y: Expr[Int]) with QuoteContext : Expr[Int] = '{ ${Expr(x)} + $y }
5+
def bar(x: Int, y: Expr[Int])(given QuoteContext): Expr[Int] = '{ ${Expr(x)} + $y }
66
}

tests/neg-macros/quote-this-b.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ class Foo {
66
}
77

88
object Foo {
9-
def impl[T](x: Any) with QuoteContext : Expr[Unit] = '{}
9+
def impl[T](x: Any)(given QuoteContext): Expr[Unit] = '{}
1010
}

tests/neg-macros/quote-this.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import scala.quoted._
22

33
class Foo {
44

5-
def f with QuoteContext : Unit = '{
5+
def f(given QuoteContext): Unit = '{
66
def bar[T](x: T): T = x
77
bar[
88
this.type // error
@@ -24,5 +24,5 @@ class Foo {
2424
}
2525

2626
object Foo {
27-
def impl[T](x: Any) with QuoteContext : Expr[Unit] = '{}
27+
def impl[T](x: Any)(given QuoteContext): Expr[Unit] = '{}
2828
}

tests/neg-macros/reflect-inline/assert_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ object api {
44
inline def (inline x: String).stripMargin2: String =
55
${ stripImpl('x) }
66

7-
private def stripImpl(x: Expr[String]) with (qctx: QuoteContext) : Expr[String] =
7+
private def stripImpl(x: Expr[String])(using qctx: QuoteContext): Expr[String] =
88
Expr(x.value.stripMargin)
99

1010
}

tests/neg-macros/splice-in-top-level-splice-1.scala

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

44
object Foo {
55
inline def foo(): Int = ${bar(${x})} // error
6-
def x with QuoteContext : Expr[Int] = '{1}
7-
def bar(i: Int) with QuoteContext : Expr[Int] = i
6+
def x(given QuoteContext): Expr[Int] = '{1}
7+
def bar(i: Int)(given QuoteContext): Expr[Int] = i
88
}

tests/neg-macros/splice-in-top-level-splice-2.scala

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

33
object Foo {
44
inline def foo(): Int = ${$x} // error
5-
def x with QuoteContext : Expr[Expr[Int]] = '{ '{1} }
5+
def x(given QuoteContext): Expr[Expr[Int]] = '{ '{1} }
66
}

tests/neg-staging/i5941/macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ object Lens {
1111
def set(t: T, s: S): S = _set(t)(s)
1212
}
1313

14-
def impl[S: Type, T: Type](getter: Expr[S => T]) with (qctx: QuoteContext) : Expr[Lens[S, T]] = {
14+
def impl[S: Type, T: Type](getter: Expr[S => T])(given qctx: QuoteContext): Expr[Lens[S, T]] = {
1515
implicit val toolbox: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(this.getClass.getClassLoader)
1616
import qctx.tasty.{_, given _}
1717
import util._

tests/neg-staging/quote-run-in-macro-1/quoted_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ object Macros {
66

77
given Toolbox = Toolbox.make(getClass.getClassLoader)
88
inline def foo(i: => Int): Int = ${ fooImpl('i) }
9-
def fooImpl(i: Expr[Int]) with QuoteContext : Expr[Int] = {
9+
def fooImpl(i: Expr[Int])(given QuoteContext): Expr[Int] = {
1010
val y: Int = run(i)
1111
y
1212
}

tests/neg-with-compiler/GenericNumLits/Even_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ object Even {
1111
else throw FromDigits.MalformedNumber(s"$digits is odd")
1212
}
1313

14-
private def evenFromDigitsImpl(digits: Expr[String]) with (ctx: QuoteContext) : Expr[Even] = digits match {
14+
private def evenFromDigitsImpl(digits: Expr[String])(given ctx: QuoteContext): Expr[Even] = digits match {
1515
case Const(ds) =>
1616
val ev =
1717
try evenFromDigits(ds)

tests/neg/BigFloat/BigFloat_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ object BigFloat extends App {
3030
BigFloat(BigInt(intPart), exponent)
3131
}
3232

33-
private def fromDigitsImpl(digits: Expr[String]) with (ctx: QuoteContext) : Expr[BigFloat] =
33+
private def fromDigitsImpl(digits: Expr[String])(given ctx: QuoteContext): Expr[BigFloat] =
3434
digits match {
3535
case Const(ds) =>
3636
try {

tests/neg/i2514.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ object Foo {
44
// ^^^^^^^^
55
// an identifier expected, but 'implicit' found
66

7-
f.with(2)
7+
f(given 2)
88
}
99

1010
val f = (implicit x: Int) => x // error // error

tests/neg/i2514a.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
object Foo {
22
def foo(): Int = {
33
val f: Int ?=> Int = (x: Int) ?=> 2 * x
4-
f.with(2)
4+
f(given 2)
55
}
66

77
val f = implicit (x: Int) => x

tests/neg/i2960.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Tag(val name: String,
2424

2525
def apply[U](f: Tag ?=> U)(implicit t: Tag = null): this.type = {
2626
if(t != null) t.children += this
27-
f.with(this)
27+
f(given this)
2828
this
2929
}
3030
}

tests/neg/i4044a.scala

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

3-
def test with QuoteContext = {
3+
def test(given QuoteContext) = {
44

55
val a = '{1}
66
'{

tests/neg/i4044b.scala

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

3-
def test with QuoteContext = {
3+
def test(given QuoteContext) = {
44

55
'{
66
given QuoteContext = ???

tests/neg/i5954b.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ abstract class MatcherFactory1[A] {
55
object MatcherFactory1 {
66
import scala.quoted._
77

8-
def impl[T](self: Expr[MatcherFactory1[T]#AndNotWord]) with QuoteContext =
8+
def impl[T](self: Expr[MatcherFactory1[T]#AndNotWord])(given QuoteContext) =
99
'{ val a: Any = $self } // error: access to type T from wrong staging level
1010

1111
}

tests/neg/i5954c.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ abstract class MatcherFactory1 {
55
object MatcherFactory1 {
66
import scala.quoted._
77

8-
def impl[T](self: Expr[MatcherFactory1#AndNotWord[T]]) with QuoteContext =
8+
def impl[T](self: Expr[MatcherFactory1#AndNotWord[T]])(given QuoteContext) =
99
'{ val a: Any = $self } // error: access to type T from wrong staging level
1010

1111
}

tests/neg/i5978.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ trait TokenParser[Token, R]
77
object TextParser {
88
given TP as TokenParser[Char, Position[CharSequence]] {}
99

10-
given FromCharToken with (T: TokenParser[Char, Position[CharSequence]])
10+
given FromCharToken(given T: TokenParser[Char, Position[CharSequence]])
1111
: Conversion[Char, Position[CharSequence]] = ???
1212
}
1313

tests/neg/i6324.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class Test {
2-
def res(x: quoted.Expr[Int]) with tasty.Reflection : quoted.Expr[Int] = x match {
2+
def res(x: quoted.Expr[Int])(given tasty.Reflection): quoted.Expr[Int] = x match {
33
case '{ 1 + $b } => // error: Type must be fully defined. Consider annotating the splice using a type ascription: (${b}: XYZ).
44
b // error: Not found: b
55
}

tests/neg/i6325.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//import scala.quoted.matching.Bind
22
object Test {
3-
def res(x: quoted.Expr[Int]) with tasty.Reflection : quoted.Expr[Int] = x match {
3+
def res(x: quoted.Expr[Int])(given tasty.Reflection): quoted.Expr[Int] = x match {
44
case '{ 1 + (${Bind(b)}: Int) } => ??? // error: Not found: Bind
55
case _ => ???
66
}

tests/neg/i6530b.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import scala.quoted._
22
object Foo {
3-
def program with QuoteContext = '{
3+
def program(given QuoteContext) = '{
44
val tpe: quoted.Type[Int] = ???
55
val expr: quoted.Expr[Int] = ???
66

tests/neg/i6739.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ import scala.quoted._
33
inline def assert(expr: => Boolean): Unit =
44
${ assertImpl('expr) } // error: Macro cannot be implemented with an `inline` method
55

6-
inline def assertImpl(expr: Expr[Boolean]) with QuoteContext : Expr[Unit] = '{ println("Hello World") }
6+
inline def assertImpl(expr: Expr[Boolean])(given QuoteContext): Expr[Unit] = '{ println("Hello World") }

tests/neg/i6762.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import scala.quoted.{_, given _}
22

33
type G[X]
44
case class Foo[T](x: T)
5-
def f(word: String) with QuoteContext : Expr[Foo[G[String]]] = '{Foo(${Expr(word)})} // error // error
5+
def f(word: String)(given QuoteContext): Expr[Foo[G[String]]] = '{Foo(${Expr(word)})} // error // error

tests/neg/i6762b.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ type Liftable
99
given Liftable = ???
1010

1111
implicit object ExprOps {
12-
def (x: T).toExpr[T] with Liftable : Expr[T] = ???
12+
def (x: T).toExpr[T](given Liftable): Expr[T] = ???
1313
}

tests/neg/i6779.check

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- [E007] Type Mismatch Error: tests/neg/i6779.scala:9:30 --------------------------------------------------------------
2-
9 |def g1[T](x: T): F[G[T]] = x.f.with(summon[Stuff]) // error
3-
| ^^^^^^^^^^^^^^^^^^^^^^^
2+
9 |def g1[T](x: T): F[G[T]] = x.f(given summon[Stuff]) // error
3+
| ^^^^^^^^^^^^^^^^^^^^^^^^
44
| Found: F[T]
55
| Required: F[G[T]]
66
-- [E007] Type Mismatch Error: tests/neg/i6779.scala:11:27 -------------------------------------------------------------
@@ -9,7 +9,7 @@
99
| Found: F[T]
1010
| Required: F[G[T]]
1111
-- [E007] Type Mismatch Error: tests/neg/i6779.scala:13:31 -------------------------------------------------------------
12-
13 |def g3[T](x: T): F[G[T]] = f(x).with(summon[Stuff]) // error
13-
| ^^^^^^^^^^^^^^^^^^^^^^^^
12+
13 |def g3[T](x: T): F[G[T]] = f(x)(given summon[Stuff]) // error
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
1414
| Found: F[T]
1515
| Required: F[G[T]]

tests/neg/i6779.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ type G[T]
33
type Stuff
44
given Stuff = ???
55

6-
def (x: T).f[T] with Stuff : F[T] = ???
6+
def (x: T).f[T](given Stuff): F[T] = ???
77

88

9-
def g1[T](x: T): F[G[T]] = x.f.with(summon[Stuff]) // error
9+
def g1[T](x: T): F[G[T]] = x.f(given summon[Stuff]) // error
1010

1111
def g2[T](x: T): F[G[T]] = x.f // error
1212

13-
def g3[T](x: T): F[G[T]] = f(x).with(summon[Stuff]) // error
13+
def g3[T](x: T): F[G[T]] = f(x)(given summon[Stuff]) // error

tests/neg/i6801.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
extension myNumericOps on [T](x: T) {
2-
def + (y: T) with (n: Numeric[T]) : T = n.plus(x,y)
2+
def + (y: T)(given n: Numeric[T]): T = n.plus(x,y)
33
}
44
def foo[T: Numeric](x: T) = 1f + x // error: no implicit argument of type Numeric[Any]
55
def bar[T: Numeric](x: T) = x + 1f // error: no implicit argument of type Numeric[Any]

tests/neg/i6997b.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import scala.quoted.{_, given _}, scala.quoted.matching._
44

55
inline def mcr(x: => Any): Any = ${mcrImpl('x)}
66

7-
def mcrImpl(body: Expr[Any]) with (ctx: QuoteContext) : Expr[Any] = {
7+
def mcrImpl(body: Expr[Any])(given ctx: QuoteContext): Expr[Any] = {
88
val '{$x: $t} = body // error
99
'{
1010
val tmp: $t = $x.asInstanceOf[$t] // error // error

tests/neg/i7013.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import quoted._
22

3-
def foo() with QuoteContext = {
3+
def foo()(given QuoteContext) = {
44
class C
55
'[C] // error
66
}

0 commit comments

Comments
 (0)