Skip to content

Commit

Permalink
Go back to (given ... parameters and arguments
Browse files Browse the repository at this point in the history
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
  • Loading branch information
odersky committed Jan 31, 2020
1 parent 54f0a85 commit bfb88cc
Show file tree
Hide file tree
Showing 344 changed files with 734 additions and 732 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import scala.quoted.autolift.{given _}
object Macros {

inline def foo(i: => Int): Int = ${ fooImpl('i) }
def fooImpl(i: Expr[Int]) with QuoteContext : Expr[Int] = {
def fooImpl(i: Expr[Int])(given QuoteContext): Expr[Int] = {
given Toolbox = Toolbox.make(getClass.getClassLoader)
val y: Int = run(i)
y
Expand Down
4 changes: 2 additions & 2 deletions tests/disabled/reflect/run/t3425b/Base_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object Gen {
}
case class Pair(tp1: Tp, tp2: Tp) {
def expr = s"((new ABC): $tp)"
def tp = s"($tp1) with $tp2"
def tp = s"($tp1) with ($tp2)"
}
val traits = Vector("Any", "A", "B", "C") map ("%6s" format _)
val types = Vector("P", "Q", "R forSome { type R <: P with Q }")
Expand All @@ -39,7 +39,7 @@ object Gen {
import p._
List(
s"type R1_$idx = $tp",
s"type R2_$idx = R1_$idx { val y: (${tp1.elem}) with ${tp2.elem} }"
s"type R2_$idx = R1_$idx { val y: (${tp1.elem}) with (${tp2.elem}) }"
)
}

Expand Down
2 changes: 1 addition & 1 deletion tests/generic-java-signatures/i3653.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Foo {
c0: T, c1: T, c2: T, c3: T, c4: T, c5: T, c6: T, c7: T, c8: T, c9: T) => 0

// #6946
def baz = (x: String ?=> Unit) => x.with("")
def baz = (x: String ?=> Unit) => x(given "")
}

object Test {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import scala.quoted.QuoteContext

def test with QuoteContext = {
def test(given QuoteContext) = {
val x = '{0}
val y = '{ // error: Canceled splice directly inside a quote. '{ ${ XYZ } } is equivalent to XYZ.
$x
Expand Down
2 changes: 1 addition & 1 deletion tests/neg-macros/GenericNumLits/Even_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object Even {
else throw FromDigits.MalformedNumber(s"$digits is odd")
}

private def evenFromDigitsImpl(digits: Expr[String]) with (ctx: QuoteContext) : Expr[Even] = digits match {
private def evenFromDigitsImpl(digits: Expr[String])(given ctx: QuoteContext): Expr[Even] = digits match {
case Const(ds) =>
val ev =
try evenFromDigits(ds)
Expand Down
2 changes: 1 addition & 1 deletion tests/neg-macros/macro-class-not-found-1/Foo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object Foo {

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

def aMacroImplementation with QuoteContext : Expr[Unit] =
def aMacroImplementation(given QuoteContext): Expr[Unit] =
throw new NoClassDefFoundError()

}
2 changes: 1 addition & 1 deletion tests/neg-macros/macro-class-not-found-2/Foo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object Foo {

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

def aMacroImplementation with QuoteContext : Expr[Unit] =
def aMacroImplementation(given QuoteContext): Expr[Unit] =
throw new NoClassDefFoundError("this.is.not.a.Class")

}
2 changes: 1 addition & 1 deletion tests/neg-macros/macros-in-same-project-1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ object Bar {

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

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

}
2 changes: 1 addition & 1 deletion tests/neg-macros/macros-in-same-project-2.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ object Bar {
inline def myMacro(): Unit = myMacro2()
inline def myMacro2(): Unit = ${ aMacroImplementation }

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

}
2 changes: 1 addition & 1 deletion tests/neg-macros/macros-in-same-project-4/Bar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ object Bar {

Foo.myMacro()

def hello() with QuoteContext : Expr[Unit] = '{ println("Hello") }
def hello()(given QuoteContext): Expr[Unit] = '{ println("Hello") }
}
2 changes: 1 addition & 1 deletion tests/neg-macros/macros-in-same-project-4/Foo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ object Foo {

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

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

}
4 changes: 2 additions & 2 deletions tests/neg-macros/macros-in-same-project-5/Bar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object Bar {

Foo.myMacro() // error

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

def hello() with QuoteContext : Expr[Unit] = '{ println("Hello") }
def hello()(given QuoteContext): Expr[Unit] = '{ println("Hello") }
}
2 changes: 1 addition & 1 deletion tests/neg-macros/quote-complex-top-splice.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ object Test {
impl(1)
}

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

}
4 changes: 2 additions & 2 deletions tests/neg-macros/quote-interpolator-core-old.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ object FInterpolation {
// ...
}

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

def fInterpolation(sc: StringContext, args: Seq[Expr[Any]]) with QuoteContext : Expr[String] = {
def fInterpolation(sc: StringContext, args: Seq[Expr[Any]])(given QuoteContext): Expr[String] = {
val str: Expr[String] = sc.parts.mkString("")
val args1: Expr[Seq[Any]] = liftSeq(args)
'{ $str.format($args1: _*) }
Expand Down
2 changes: 1 addition & 1 deletion tests/neg-macros/quote-macro-complex-arg-0.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import scala.quoted._

object Macros {
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
def bar(x: Int, y: Expr[Int]) with QuoteContext : Expr[Int] = '{ ${Expr(x)} + $y }
def bar(x: Int, y: Expr[Int])(given QuoteContext): Expr[Int] = '{ ${Expr(x)} + $y }
}
2 changes: 1 addition & 1 deletion tests/neg-macros/quote-this-b.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ class Foo {
}

object Foo {
def impl[T](x: Any) with QuoteContext : Expr[Unit] = '{}
def impl[T](x: Any)(given QuoteContext): Expr[Unit] = '{}
}
4 changes: 2 additions & 2 deletions tests/neg-macros/quote-this.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import scala.quoted._

class Foo {

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

object Foo {
def impl[T](x: Any) with QuoteContext : Expr[Unit] = '{}
def impl[T](x: Any)(given QuoteContext): Expr[Unit] = '{}
}
2 changes: 1 addition & 1 deletion tests/neg-macros/reflect-inline/assert_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object api {
inline def (inline x: String).stripMargin2: String =
${ stripImpl('x) }

private def stripImpl(x: Expr[String]) with (qctx: QuoteContext) : Expr[String] =
private def stripImpl(x: Expr[String])(using qctx: QuoteContext): Expr[String] =
Expr(x.value.stripMargin)

}
4 changes: 2 additions & 2 deletions tests/neg-macros/splice-in-top-level-splice-1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import scala.quoted.autolift.{given _}

object Foo {
inline def foo(): Int = ${bar(${x})} // error
def x with QuoteContext : Expr[Int] = '{1}
def bar(i: Int) with QuoteContext : Expr[Int] = i
def x(given QuoteContext): Expr[Int] = '{1}
def bar(i: Int)(given QuoteContext): Expr[Int] = i
}
2 changes: 1 addition & 1 deletion tests/neg-macros/splice-in-top-level-splice-2.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import scala.quoted._

object Foo {
inline def foo(): Int = ${$x} // error
def x with QuoteContext : Expr[Expr[Int]] = '{ '{1} }
def x(given QuoteContext): Expr[Expr[Int]] = '{ '{1} }
}
2 changes: 1 addition & 1 deletion tests/neg-staging/i5941/macro_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object Lens {
def set(t: T, s: S): S = _set(t)(s)
}

def impl[S: Type, T: Type](getter: Expr[S => T]) with (qctx: QuoteContext) : Expr[Lens[S, T]] = {
def impl[S: Type, T: Type](getter: Expr[S => T])(given qctx: QuoteContext): Expr[Lens[S, T]] = {
implicit val toolbox: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(this.getClass.getClassLoader)
import qctx.tasty.{_, given _}
import util._
Expand Down
2 changes: 1 addition & 1 deletion tests/neg-staging/quote-run-in-macro-1/quoted_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ object Macros {

given Toolbox = Toolbox.make(getClass.getClassLoader)
inline def foo(i: => Int): Int = ${ fooImpl('i) }
def fooImpl(i: Expr[Int]) with QuoteContext : Expr[Int] = {
def fooImpl(i: Expr[Int])(given QuoteContext): Expr[Int] = {
val y: Int = run(i)
y
}
Expand Down
2 changes: 1 addition & 1 deletion tests/neg-with-compiler/GenericNumLits/Even_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object Even {
else throw FromDigits.MalformedNumber(s"$digits is odd")
}

private def evenFromDigitsImpl(digits: Expr[String]) with (ctx: QuoteContext) : Expr[Even] = digits match {
private def evenFromDigitsImpl(digits: Expr[String])(given ctx: QuoteContext): Expr[Even] = digits match {
case Const(ds) =>
val ev =
try evenFromDigits(ds)
Expand Down
2 changes: 1 addition & 1 deletion tests/neg/BigFloat/BigFloat_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ object BigFloat extends App {
BigFloat(BigInt(intPart), exponent)
}

private def fromDigitsImpl(digits: Expr[String]) with (ctx: QuoteContext) : Expr[BigFloat] =
private def fromDigitsImpl(digits: Expr[String])(given ctx: QuoteContext): Expr[BigFloat] =
digits match {
case Const(ds) =>
try {
Expand Down
2 changes: 1 addition & 1 deletion tests/neg/i2514.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object Foo {
// ^^^^^^^^
// an identifier expected, but 'implicit' found

f.with(2)
f(given 2)
}

val f = (implicit x: Int) => x // error // error
Expand Down
2 changes: 1 addition & 1 deletion tests/neg/i2514a.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
object Foo {
def foo(): Int = {
val f: Int ?=> Int = (x: Int) ?=> 2 * x
f.with(2)
f(given 2)
}

val f = implicit (x: Int) => x
Expand Down
2 changes: 1 addition & 1 deletion tests/neg/i2960.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Tag(val name: String,

def apply[U](f: Tag ?=> U)(implicit t: Tag = null): this.type = {
if(t != null) t.children += this
f.with(this)
f(given this)
this
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/neg/i4044a.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import scala.quoted._

def test with QuoteContext = {
def test(given QuoteContext) = {

val a = '{1}
'{
Expand Down
2 changes: 1 addition & 1 deletion tests/neg/i4044b.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import scala.quoted._

def test with QuoteContext = {
def test(given QuoteContext) = {

'{
given QuoteContext = ???
Expand Down
2 changes: 1 addition & 1 deletion tests/neg/i5954b.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ abstract class MatcherFactory1[A] {
object MatcherFactory1 {
import scala.quoted._

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

}
2 changes: 1 addition & 1 deletion tests/neg/i5954c.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ abstract class MatcherFactory1 {
object MatcherFactory1 {
import scala.quoted._

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

}
2 changes: 1 addition & 1 deletion tests/neg/i5978.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trait TokenParser[Token, R]
object TextParser {
given TP as TokenParser[Char, Position[CharSequence]] {}

given FromCharToken with (T: TokenParser[Char, Position[CharSequence]])
given FromCharToken(given T: TokenParser[Char, Position[CharSequence]])
: Conversion[Char, Position[CharSequence]] = ???
}

Expand Down
2 changes: 1 addition & 1 deletion tests/neg/i6324.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Test {
def res(x: quoted.Expr[Int]) with tasty.Reflection : quoted.Expr[Int] = x match {
def res(x: quoted.Expr[Int])(given tasty.Reflection): quoted.Expr[Int] = x match {
case '{ 1 + $b } => // error: Type must be fully defined. Consider annotating the splice using a type ascription: (${b}: XYZ).
b // error: Not found: b
}
Expand Down
2 changes: 1 addition & 1 deletion tests/neg/i6325.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//import scala.quoted.matching.Bind
object Test {
def res(x: quoted.Expr[Int]) with tasty.Reflection : quoted.Expr[Int] = x match {
def res(x: quoted.Expr[Int])(given tasty.Reflection): quoted.Expr[Int] = x match {
case '{ 1 + (${Bind(b)}: Int) } => ??? // error: Not found: Bind
case _ => ???
}
Expand Down
2 changes: 1 addition & 1 deletion tests/neg/i6530b.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import scala.quoted._
object Foo {
def program with QuoteContext = '{
def program(given QuoteContext) = '{
val tpe: quoted.Type[Int] = ???
val expr: quoted.Expr[Int] = ???

Expand Down
2 changes: 1 addition & 1 deletion tests/neg/i6739.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import scala.quoted._
inline def assert(expr: => Boolean): Unit =
${ assertImpl('expr) } // error: Macro cannot be implemented with an `inline` method

inline def assertImpl(expr: Expr[Boolean]) with QuoteContext : Expr[Unit] = '{ println("Hello World") }
inline def assertImpl(expr: Expr[Boolean])(given QuoteContext): Expr[Unit] = '{ println("Hello World") }
2 changes: 1 addition & 1 deletion tests/neg/i6762.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import scala.quoted.{_, given _}

type G[X]
case class Foo[T](x: T)
def f(word: String) with QuoteContext : Expr[Foo[G[String]]] = '{Foo(${Expr(word)})} // error // error
def f(word: String)(given QuoteContext): Expr[Foo[G[String]]] = '{Foo(${Expr(word)})} // error // error
2 changes: 1 addition & 1 deletion tests/neg/i6762b.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ type Liftable
given Liftable = ???

implicit object ExprOps {
def (x: T).toExpr[T] with Liftable : Expr[T] = ???
def (x: T).toExpr[T](given Liftable): Expr[T] = ???
}
8 changes: 4 additions & 4 deletions tests/neg/i6779.check
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- [E007] Type Mismatch Error: tests/neg/i6779.scala:9:30 --------------------------------------------------------------
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
| ^^^^^^^^^^^^^^^^^^^^^^^^
| Found: F[T]
| Required: F[G[T]]
-- [E007] Type Mismatch Error: tests/neg/i6779.scala:11:27 -------------------------------------------------------------
Expand All @@ -9,7 +9,7 @@
| Found: F[T]
| Required: F[G[T]]
-- [E007] Type Mismatch Error: tests/neg/i6779.scala:13:31 -------------------------------------------------------------
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
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| Found: F[T]
| Required: F[G[T]]
6 changes: 3 additions & 3 deletions tests/neg/i6779.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ type G[T]
type Stuff
given Stuff = ???

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


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

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

def g3[T](x: T): F[G[T]] = f(x).with(summon[Stuff]) // error
def g3[T](x: T): F[G[T]] = f(x)(given summon[Stuff]) // error
2 changes: 1 addition & 1 deletion tests/neg/i6801.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extension myNumericOps on [T](x: T) {
def + (y: T) with (n: Numeric[T]) : T = n.plus(x,y)
def + (y: T)(given n: Numeric[T]): T = n.plus(x,y)
}
def foo[T: Numeric](x: T) = 1f + x // error: no implicit argument of type Numeric[Any]
def bar[T: Numeric](x: T) = x + 1f // error: no implicit argument of type Numeric[Any]
2 changes: 1 addition & 1 deletion tests/neg/i6997b.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import scala.quoted.{_, given _}, scala.quoted.matching._

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

def mcrImpl(body: Expr[Any]) with (ctx: QuoteContext) : Expr[Any] = {
def mcrImpl(body: Expr[Any])(given ctx: QuoteContext): Expr[Any] = {
val '{$x: $t} = body // error
'{
val tmp: $t = $x.asInstanceOf[$t] // error // error
Expand Down
2 changes: 1 addition & 1 deletion tests/neg/i7013.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import quoted._

def foo() with QuoteContext = {
def foo()(given QuoteContext) = {
class C
'[C] // error
}
Loading

0 comments on commit bfb88cc

Please sign in to comment.