diff --git a/tests/init/crash/i6914.scala b/tests/init/crash/i6914.scala index 723b2ef94e0b..b5f848626772 100644 --- a/tests/init/crash/i6914.scala +++ b/tests/init/crash/i6914.scala @@ -5,7 +5,7 @@ object test1 { class ToExpr[T](using Liftable[T]) extends Conversion[T, Expr[T]] { def apply(x: T): Expr[T] = ??? } - given toExprFun[T](using Liftable[T]): ToExpr[T] with {} + given toExprFun: [T] => Liftable[T] => ToExpr[T]() given Liftable[Int] = ??? given Liftable[String] = ??? @@ -16,14 +16,12 @@ object test1 { def a: Expr[String] = "abc" } -object test2 { +object test2: - given autoToExpr[T](using Liftable[T]): Conversion[T, Expr[T]] with { + given autoToExpr: [T] => Liftable[T] => Conversion[T, Expr[T]]: def apply(x: T): Expr[T] = ??? - } given Liftable[Int] = ??? given Liftable[String] = ??? def a: Expr[String] = "abc" -} \ No newline at end of file diff --git a/tests/init/crash/i7821.scala b/tests/init/crash/i7821.scala index 1574801826bc..f99037573c75 100644 --- a/tests/init/crash/i7821.scala +++ b/tests/init/crash/i7821.scala @@ -3,9 +3,8 @@ object XObject { def anX: X = 5 - given ops: Object with { + given ops: Object: extension (x: X) def + (y: X): X = x + y - } } object MyXObject { @@ -13,9 +12,8 @@ object MyXObject { def anX: MyX = XObject.anX - given ops: Object with { + given ops: Object: extension (x: MyX) def + (y: MyX): MyX = x + y // error: warring: Infinite recursive call - } } object Main extends App { diff --git a/tests/neg-macros/BigFloat/BigFloat_1.scala b/tests/neg-macros/BigFloat/BigFloat_1.scala index 5bb5b49587bd..246e3dcd442d 100644 --- a/tests/neg-macros/BigFloat/BigFloat_1.scala +++ b/tests/neg-macros/BigFloat/BigFloat_1.scala @@ -35,7 +35,7 @@ object BigFloat extends App { def fromDigits(digits: String) = apply(digits) } - given BigFloatFromDigits with { + given BigFloatFromDigits { override inline def fromDigits(digits: String) = ${ BigFloatFromDigitsImpl('digits) } @@ -43,7 +43,7 @@ object BigFloat extends App { // Should be in StdLib: - given ToExpr[BigInt] with { + given ToExpr[BigInt] { def apply(x: BigInt)(using Quotes) = '{BigInt(${Expr(x.toString)})} } diff --git a/tests/neg-macros/GenericNumLits/Even_1.scala b/tests/neg-macros/GenericNumLits/Even_1.scala index 24bcf32cc7c0..5772d98d3808 100644 --- a/tests/neg-macros/GenericNumLits/Even_1.scala +++ b/tests/neg-macros/GenericNumLits/Even_1.scala @@ -16,7 +16,7 @@ object Even { def fromDigits(digits: String) = evenFromDigits(digits) } - given EvenFromDigits with { + given EvenFromDigits { override transparent inline def fromDigits(digits: String) = ${ EvenFromDigitsImpl('digits) } diff --git a/tests/neg-macros/i11483/Test_2.scala b/tests/neg-macros/i11483/Test_2.scala index 6fe975168684..e61716615d22 100644 --- a/tests/neg-macros/i11483/Test_2.scala +++ b/tests/neg-macros/i11483/Test_2.scala @@ -3,7 +3,7 @@ package x import scala.language.implicitConversions import scala.concurrent.Future -given FutureAsyncMonad: CpsMonad[Future] with +given FutureAsyncMonad: CpsMonad[Future]: def pure[T](t:T): Future[T] = ??? def impure[T](t:Future[T]): T = ??? def map[A,B](x:Future[A])(f: A=>B): Future[B] = ??? diff --git a/tests/neg-macros/i17152/DFBits.scala b/tests/neg-macros/i17152/DFBits.scala index dd0e8b88a962..a88485b56dc6 100644 --- a/tests/neg-macros/i17152/DFBits.scala +++ b/tests/neg-macros/i17152/DFBits.scala @@ -16,7 +16,7 @@ trait Baz trait Width[T]: type Out <: Int object Width: - given fromDFBoolOrBit[T <: DFBoolOrBit]: Width[T] with + given fromDFBoolOrBit: [T <: DFBoolOrBit] => Width[T]: type Out = 1 transparent inline given [T]: Width[T] = ${ getWidthMacro[T] } def getWidthMacro[T](using Quotes, Type[T]): Expr[Width[T]] = @@ -38,7 +38,7 @@ private object CompanionsDFBits: type OutW <: Int def apply(value: R): DFValOf[DFBits[OutW]] object Candidate: - given fromDFUInt[W <: Int, R <: DFValOf[DFDecimal]]: Candidate[R] with + given fromDFUInt: [W <: Int, R <: DFValOf[DFDecimal]] => Candidate[R]: type OutW = W def apply(value: R): DFValOf[DFBits[W]] = import DFVal.Ops.bits diff --git a/tests/neg-macros/i19601/Macro.scala b/tests/neg-macros/i19601/Macro.scala index 8d6d22005017..06260ab8c981 100644 --- a/tests/neg-macros/i19601/Macro.scala +++ b/tests/neg-macros/i19601/Macro.scala @@ -10,7 +10,7 @@ object Macros { '{ () } } - given [A](using Type[A]): FromExpr[Assertion[A]] with { + given [A] => Type[A] => FromExpr[Assertion[A]] { def unapply(assertion: Expr[Assertion[A]])(using Quotes): Option[Assertion[A]] = { import quotes.reflect.* diff --git a/tests/neg-macros/i7919.scala b/tests/neg-macros/i7919.scala index e68965fc614f..74863282e09a 100644 --- a/tests/neg-macros/i7919.scala +++ b/tests/neg-macros/i7919.scala @@ -3,16 +3,16 @@ import scala.quoted.* object Test { def staged[T](using Quotes) = { import quotes.reflect.* - given typeT: Type[T] with {} // error + given typeT: Type[T] {} // error val tt = TypeRepr.of[T] '{ "in staged" } } - given Expr[Int] with {} // error + given Expr[Int] {} // error new Expr[Int] // error class Expr2 extends Expr[Int] // error - given Type[Int] with {} // error + given Type[Int] {} // error new Type[Int] // error class Type2 extends Type[Int] // error diff --git a/tests/neg-with-compiler/GenericNumLits/Even_1.scala b/tests/neg-with-compiler/GenericNumLits/Even_1.scala index 0867150dd944..7f5824b30957 100644 --- a/tests/neg-with-compiler/GenericNumLits/Even_1.scala +++ b/tests/neg-with-compiler/GenericNumLits/Even_1.scala @@ -16,7 +16,7 @@ object Even { def fromDigits(digits: String) = evenFromDigits(digits) } - given EvenFromDigits with { + given EvenFromDigits { override inline def fromDigits(digits: String) = ${ EvenFromDigitsImpl('digits) } diff --git a/tests/neg/17579.check b/tests/neg/17579.check index 1149f9c0faa4..24b7d354dcb6 100644 --- a/tests/neg/17579.check +++ b/tests/neg/17579.check @@ -25,6 +25,6 @@ | | longer explanation available when compiling with `-explain` -- [E147] Syntax Warning: tests/neg/17579.scala:19:6 ------------------------------------------------------------------- -19 | final given Object with {} // warning: modifier `final` is redundant for this definition +19 | final given Object() // warning: modifier `final` is redundant for this definition | ^^^^^ | Modifier final is redundant for this definition diff --git a/tests/neg/17579.scala b/tests/neg/17579.scala index 268199e9006f..0ffd20d4b267 100644 --- a/tests/neg/17579.scala +++ b/tests/neg/17579.scala @@ -16,7 +16,7 @@ class C: { // No error in this case, because the `given` is translated to a class // definition, for which `final` is redundant but not illegal. - final given Object with {} // warning: modifier `final` is redundant for this definition + final given Object() // warning: modifier `final` is redundant for this definition } { diff --git a/tests/neg/19414.scala b/tests/neg/19414.scala index bb275ad943b7..8843441e81f2 100644 --- a/tests/neg/19414.scala +++ b/tests/neg/19414.scala @@ -9,7 +9,7 @@ class Printer given Writer[JsValue] = ??? given Writer[JsObject] = ??? -given [B: Writer](using printer: Printer = new Printer): BodySerializer[B] = ??? +given [B: Writer] => (printer: Printer = new Printer) => BodySerializer[B] = ??? def f: Unit = summon[BodySerializer[JsObject]] // error: Ambiguous given instances diff --git a/tests/neg/21538.scala b/tests/neg/21538.scala index 761e9cde678a..66500277159e 100644 --- a/tests/neg/21538.scala +++ b/tests/neg/21538.scala @@ -1,3 +1,3 @@ trait Bar[T] -given [T]: Bar[T] with {} +given [T] => Bar[T]() inline def foo[V](inline value: V)(using Bar[value.type]) : Unit = {} // error \ No newline at end of file diff --git a/tests/neg/abstract-givens.check b/tests/neg/abstract-givens.check index 022c454c31f1..1430c5b6e950 100644 --- a/tests/neg/abstract-givens.check +++ b/tests/neg/abstract-givens.check @@ -1,5 +1,5 @@ -- Error: tests/neg/abstract-givens.scala:11:8 ------------------------------------------------------------------------- -11 | given s[T](using T): Seq[T] with // error +11 | given s: [T] => T => Seq[T]: // error | ^ |instance cannot be created, since def iterator: Iterator[A] in trait IterableOnce in package scala.collection is not defined -- [E164] Declaration Error: tests/neg/abstract-givens.scala:8:8 ------------------------------------------------------- diff --git a/tests/neg/abstract-givens.scala b/tests/neg/abstract-givens.scala index 5aa5bdee88e3..dbd4a7a85927 100644 --- a/tests/neg/abstract-givens.scala +++ b/tests/neg/abstract-givens.scala @@ -8,7 +8,7 @@ object Test extends T: given y(using Int): String = summon[Int].toString * 22 // error given z[T](using T): Seq[T] = List(summon[T]) // error - given s[T](using T): Seq[T] with // error + given s: [T] => T => Seq[T]: // error def apply(x: Int) = ??? override def length = ??? diff --git a/tests/neg/eql.scala b/tests/neg/eql.scala index 58378800bbc5..40ec1fb5d9ed 100644 --- a/tests/neg/eql.scala +++ b/tests/neg/eql.scala @@ -1,7 +1,7 @@ object lst: opaque type Lst[+T] = Any object Lst: - given lstCanEqual[T, U]: CanEqual[Lst[T], Lst[U]] = CanEqual.derived + given lstCanEqual: [T, U] => CanEqual[Lst[T], Lst[U]] = CanEqual.derived val Empty: Lst[Nothing] = ??? end lst diff --git a/tests/neg/exports.scala b/tests/neg/exports.scala index c187582c940d..459a56e88c4f 100644 --- a/tests/neg/exports.scala +++ b/tests/neg/exports.scala @@ -5,7 +5,7 @@ type PrinterType def print(bits: BitMap): Unit = ??? def status: List[String] = ??? - given bitmap: BitMap with {} + given bitmap: BitMap() } class Scanner { diff --git a/tests/neg/extmethod-overload.scala b/tests/neg/extmethod-overload.scala index 8fa7c05222a1..ef927c0be6ce 100644 --- a/tests/neg/extmethod-overload.scala +++ b/tests/neg/extmethod-overload.scala @@ -1,16 +1,15 @@ -object Test { - given a: AnyRef with - extension (x: Int) { +object Test: + + given a: AnyRef: + extension (x: Int) def |+| (y: Int) = x + y - } - given b: AnyRef with - extension (x: Int) { + + given b: AnyRef: + extension (x: Int) def |+| (y: String) = x + y.length - } + assert((1 |+| 2) == 3) // error ambiguous - locally { + locally: import b.|+| assert((1 |+| "2") == 2) // OK - } -} \ No newline at end of file diff --git a/tests/neg/gadt-approximation-interaction.scala b/tests/neg/gadt-approximation-interaction.scala index 5f010e4b784d..a6bfe0d44007 100644 --- a/tests/neg/gadt-approximation-interaction.scala +++ b/tests/neg/gadt-approximation-interaction.scala @@ -28,7 +28,7 @@ object GivenLookup { class Tag[T] - given ti: Tag[Int] with {} + given ti: Tag[Int]() def foo[T](t: T, ev: T SUB Int) = ev match { case SUB.Refl() => diff --git a/tests/neg/genericNumbers.scala b/tests/neg/genericNumbers.scala index 0c5769f7ba12..7c08caeb4e9d 100644 --- a/tests/neg/genericNumbers.scala +++ b/tests/neg/genericNumbers.scala @@ -7,13 +7,11 @@ object Test extends App { case class Even(n: Int) - given FromDigits[Even] with { - def fromDigits(digits: String): Even = { + given FromDigits[Even]: + def fromDigits(digits: String): Even = val intValue = digits.toInt if (intValue % 2 == 0) Even(intValue) else throw FromDigits.MalformedNumber() - } - } val e: Even = 1234 // error diff --git a/tests/neg/given-loop-prevention.scala b/tests/neg/given-loop-prevention.scala index 9d404b8c6d8e..9ad2163a4bf8 100644 --- a/tests/neg/given-loop-prevention.scala +++ b/tests/neg/given-loop-prevention.scala @@ -2,11 +2,11 @@ class Foo object Bar { - given Foo with {} + given Foo() given List[Foo] = List(summon[Foo]) // ok } object Baz { given List[Foo] = List(summon[Foo]) // error - given Foo with {} + given Foo() } diff --git a/tests/neg/i10901.scala b/tests/neg/i10901.scala index dc1ea6e6eef6..996a0753c2e7 100644 --- a/tests/neg/i10901.scala +++ b/tests/neg/i10901.scala @@ -53,7 +53,7 @@ object BugExp4Point2D { class C object Container: - given C with {} + given C() object Test: extension (x: String)(using C) diff --git a/tests/neg/i11985.scala b/tests/neg/i11985.scala index fee056594974..52313ab09c99 100644 --- a/tests/neg/i11985.scala +++ b/tests/neg/i11985.scala @@ -11,10 +11,8 @@ object Test { def get(t: TT): C } - given [T <: Tuple, C, EV <: TupleTypeIndex[T, C]]: TupleExtractor[T, C] with { + given [T <: Tuple, C, EV <: TupleTypeIndex[T, C]] => TupleExtractor[T, C]: def get(t: T): C = t.toArray.apply(toIntC[TupleTypeIndex[T, C]]).asInstanceOf[C] // error - } - transparent inline def toIntC[N <: Int]: Int = inline constValue[N] match diff --git a/tests/neg/i14177a.scala b/tests/neg/i14177a.scala index 237eaacb3b66..91a63bdd6345 100644 --- a/tests/neg/i14177a.scala +++ b/tests/neg/i14177a.scala @@ -2,5 +2,5 @@ import scala.compiletime.* trait C[A] -inline given [Tup <: Tuple]: C[Tup] with +inline given [Tup <: Tuple] => C[Tup]: val cs = summonAll[Tuple.Map[Tup, C]] // error: Tuple element types must be known at compile time diff --git a/tests/neg/i15474b.scala b/tests/neg/i15474b.scala index 0c04b9880e1c..0a99056f8a6e 100644 --- a/tests/neg/i15474b.scala +++ b/tests/neg/i15474b.scala @@ -3,6 +3,6 @@ import scala.language.implicitConversions object Test1: - given c: Conversion[ String, Int ] with + given c: Conversion[ String, Int ]: def apply(from: String): Int = from.toInt // warn: infinite loop in function body // nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) diff --git a/tests/neg/i16453.scala b/tests/neg/i16453.scala index 00495c39e21a..b5767ac35417 100644 --- a/tests/neg/i16453.scala +++ b/tests/neg/i16453.scala @@ -12,7 +12,7 @@ def testScala3() = { given Conversion[Char, String] = ??? given Conversion[Char, Option[Int]] = ??? - given foo: Foo with + given foo: Foo: type T = Int given bar3: Int = 0 given baz3: Char = 'a' diff --git a/tests/neg/i19328conversion.scala b/tests/neg/i19328conversion.scala index 46dd1058b579..458bd5abb5b1 100644 --- a/tests/neg/i19328conversion.scala +++ b/tests/neg/i19328conversion.scala @@ -5,7 +5,7 @@ object i19328conversion: type Id[A] = A - given wrapId[A]: Conversion[A, Id[A]] with + given wrapId: [A] => Conversion[A, Id[A]]: def apply(x: A): Id[A] = x def bar(using bool: Boolean): Unit = () diff --git a/tests/neg/i5978.scala b/tests/neg/i5978.scala index 5dddfafb8726..b7e0344ec1c9 100644 --- a/tests/neg/i5978.scala +++ b/tests/neg/i5978.scala @@ -5,7 +5,7 @@ opaque type Position[Buffer] = Int trait TokenParser[Token, R] object TextParser { - given TP: TokenParser[Char, Position[CharSequence]] with {} + given TP: TokenParser[Char, Position[CharSequence]]() given FromCharToken(using T: TokenParser[Char, Position[CharSequence]]) : Conversion[Char, Position[CharSequence]] = ??? diff --git a/tests/neg/i6716.scala b/tests/neg/i6716.scala index eece8af9e560..a9826cb901c0 100644 --- a/tests/neg/i6716.scala +++ b/tests/neg/i6716.scala @@ -1,12 +1,12 @@ class Foo object Bar { - given Foo with {} + given Foo() given List[Foo] = List(summon[Foo]) // ok } object Baz { @annotation.nowarn given List[Foo] = List(summon[Foo]) // error - given Foo with {} + given Foo() } diff --git a/tests/neg/i7459.scala b/tests/neg/i7459.scala index a17f32b15afa..829132e5179d 100644 --- a/tests/neg/i7459.scala +++ b/tests/neg/i7459.scala @@ -22,7 +22,7 @@ trait Eq[T] { } object Eq { - given Eq[Int] with { + given Eq[Int] { def eqv(x: Int, y: Int) = x == y } diff --git a/tests/neg/i8896-a.scala b/tests/neg/i8896-a.scala index ae2cd6e88f6c..9f0953bfe939 100644 --- a/tests/neg/i8896-a.scala +++ b/tests/neg/i8896-a.scala @@ -4,8 +4,7 @@ trait Foo[A] object Example { - given Foo[Int] with { - } + given Foo[Int]() def foo0[A: Foo]: A => A = identity def foo1[A](implicit foo: Foo[A]): A => A = identity diff --git a/tests/neg/i8896-b.scala b/tests/neg/i8896-b.scala index a2559b00b3cc..f562d2d3b719 100644 --- a/tests/neg/i8896-b.scala +++ b/tests/neg/i8896-b.scala @@ -4,8 +4,7 @@ trait Foo[A] object Example { - given Foo[Int] with { - } + given Foo[Int]() def foo0[A: Foo]: A => A = identity def foo1[A](implicit foo: Foo[A]): A => A = identity diff --git a/tests/neg/i9185.scala b/tests/neg/i9185.scala index 34727eff1c46..8ec28135c1b9 100644 --- a/tests/neg/i9185.scala +++ b/tests/neg/i9185.scala @@ -1,8 +1,8 @@ trait M[F[_]] { def pure[A](x: A): F[A] } object M { extension [A, F[A]](x: A) def pure(using m: M[F]): F[A] = m.pure(x) - given listMonad: M[List] with { def pure[A](x: A): List[A] = List(x) } - given optionMonad: M[Option] with { def pure[A](x: A): Option[A] = Some(x) } + given listMonad: M[List] { def pure[A](x: A): List[A] = List(x) } + given optionMonad: M[Option] { def pure[A](x: A): Option[A] = Some(x) } val value1: List[String] = "ola".pure val value2 = "ola".pure // error val value3 = M.pure("ola") // error diff --git a/tests/neg/i9928.scala b/tests/neg/i9928.scala index a1034b1f20e9..cfe9cf663a85 100644 --- a/tests/neg/i9928.scala +++ b/tests/neg/i9928.scala @@ -2,7 +2,7 @@ trait Magic[F]: extension (x: Int) def read: F object Magic: - given Magic[String] with + given Magic[String]: extension(x: Int) def read: String = println("In string") s"$x" @@ -12,7 +12,7 @@ object Foo: import Magic.given def apply(s: String): Foo = s - given Magic[Foo] with + given Magic[Foo]: extension (x: Int) def read: Foo = println("In foo") Foo(s"$x") diff --git a/tests/neg/implicit-package-object.scala b/tests/neg/implicit-package-object.scala index 7b73d620b9b8..6d8c5d9ddff0 100644 --- a/tests/neg/implicit-package-object.scala +++ b/tests/neg/implicit-package-object.scala @@ -13,7 +13,7 @@ package A { given ToString[AB] = ab => println(ab) opaque type AC = String - given ToString[AC] with { + given ToString[AC] { def print(ac: AC): Unit = println(ac) } } @@ -31,7 +31,7 @@ package B { opaque type BC = String object BC { - given ToString[BC] with { + given ToString[BC] { def print(bc: BC): Unit = println(bc) } } diff --git a/tests/neg/implied-for.scala b/tests/neg/implied-for.scala index 87f762870400..cb43f799ee50 100644 --- a/tests/neg/implied-for.scala +++ b/tests/neg/implied-for.scala @@ -3,8 +3,8 @@ class B extends T class C extends T object A { - given b: B with {} - given c: C with {} + given b: B() + given c: C() } object Test extends App { diff --git a/tests/neg/import-given.scala b/tests/neg/import-given.scala index 080ed1e77ec5..1e5a9536c605 100644 --- a/tests/neg/import-given.scala +++ b/tests/neg/import-given.scala @@ -1,6 +1,6 @@ class TC object A { - given tc: TC with {} + given tc: TC() def foo(using TC) = () } object B { diff --git a/tests/neg/missing-implicit6.check b/tests/neg/missing-implicit6.check index 8c4cb331808b..7d6e16c0ec93 100644 --- a/tests/neg/missing-implicit6.check +++ b/tests/neg/missing-implicit6.check @@ -1,9 +1,9 @@ --- [E008] Not Found Error: tests/neg/missing-implicit6.scala:34:8 ------------------------------------------------------ -34 | "a".xxx // error, no suggested import +-- [E008] Not Found Error: tests/neg/missing-implicit6.scala:32:8 ------------------------------------------------------ +32 | "a".xxx // error, no suggested import | ^^^^^^^ | value xxx is not a member of String --- [E008] Not Found Error: tests/neg/missing-implicit6.scala:35:8 ------------------------------------------------------ -35 | 123.xxx // error, suggested import +-- [E008] Not Found Error: tests/neg/missing-implicit6.scala:33:8 ------------------------------------------------------ +33 | 123.xxx // error, suggested import | ^^^^^^^ | value xxx is not a member of Int, but could be made available as an extension method. | @@ -11,8 +11,8 @@ | | import Test.Ops.xxx | --- [E008] Not Found Error: tests/neg/missing-implicit6.scala:36:8 ------------------------------------------------------ -36 | 123.yyy // error, suggested import +-- [E008] Not Found Error: tests/neg/missing-implicit6.scala:34:8 ------------------------------------------------------ +34 | 123.yyy // error, suggested import | ^^^^^^^ | value yyy is not a member of Int, but could be made available as an extension method. | @@ -20,16 +20,16 @@ | | import Test.Ops.yyy | --- [E008] Not Found Error: tests/neg/missing-implicit6.scala:41:8 ------------------------------------------------------ -41 | 123.xxx // error, no suggested import +-- [E008] Not Found Error: tests/neg/missing-implicit6.scala:39:8 ------------------------------------------------------ +39 | 123.xxx // error, no suggested import | ^^^^^^^ | value xxx is not a member of Int --- [E008] Not Found Error: tests/neg/missing-implicit6.scala:42:8 ------------------------------------------------------ -42 | 123.yyy // error, no suggested import +-- [E008] Not Found Error: tests/neg/missing-implicit6.scala:40:8 ------------------------------------------------------ +40 | 123.yyy // error, no suggested import | ^^^^^^^ | value yyy is not a member of Int --- [E008] Not Found Error: tests/neg/missing-implicit6.scala:43:8 ------------------------------------------------------ -43 | 123.zzz // error, suggested import even though there's no instance of Bar in scope +-- [E008] Not Found Error: tests/neg/missing-implicit6.scala:41:8 ------------------------------------------------------ +41 | 123.zzz // error, suggested import even though there's no instance of Bar in scope | ^^^^^^^ | value zzz is not a member of Int, but could be made available as an extension method. | diff --git a/tests/neg/missing-implicit6.scala b/tests/neg/missing-implicit6.scala index ded6e5ba8fed..874ae77bb50f 100644 --- a/tests/neg/missing-implicit6.scala +++ b/tests/neg/missing-implicit6.scala @@ -7,13 +7,11 @@ trait Bar { } object instances { - given foo: Foo with { + given foo: Foo: type Out = Bar - } - given bar: Bar with { + given bar: Bar: type Out = Int - } } object Test { diff --git a/tests/neg/struct-given.scala b/tests/neg/struct-given.scala index 9bcd1630d448..13e0d98795fa 100644 --- a/tests/neg/struct-given.scala +++ b/tests/neg/struct-given.scala @@ -1,5 +1,5 @@ class C -given c[T]: C with +given c: [T] => C: def foo = 1 given d[T]: C = new C { def foo = 1 } diff --git a/tests/patmat/i6088.scala b/tests/patmat/i6088.scala index 8d8f676c0101..c88ae35a0c2f 100644 --- a/tests/patmat/i6088.scala +++ b/tests/patmat/i6088.scala @@ -17,7 +17,7 @@ enum ExprF[R[_],I] { /** Companion. */ object ExprF { - given hfunctor: HFunctor[ExprF] with { + given hfunctor: HFunctor[ExprF] { def hmap[A[_], B[_]](nt: A ~> B): ([x] =>> ExprF[A,x]) ~> ([x] =>> ExprF[B,x]) = { new ~>[[x] =>> ExprF[A,x], [x] =>> ExprF[B,x]] { def apply[I](fa: ExprF[A,I]): ExprF[B,I] = fa match { diff --git a/tests/pos-custom-args/captures/i16116.scala b/tests/pos-custom-args/captures/i16116.scala index 979bfdbe4328..fdc386ac40e1 100644 --- a/tests/pos-custom-args/captures/i16116.scala +++ b/tests/pos-custom-args/captures/i16116.scala @@ -9,7 +9,7 @@ trait CpsMonad[F[_]] { object CpsMonad { type Aux[F[_],C] = CpsMonad[F] { type Context = C } - given CpsMonad[Future] with {} + given CpsMonad[Future]() } @experimental diff --git a/tests/pos-macros/exprSummonWithTypeVar/Macro_1.scala b/tests/pos-macros/exprSummonWithTypeVar/Macro_1.scala index 72bcbe8b6515..2fac9b9a7f8d 100644 --- a/tests/pos-macros/exprSummonWithTypeVar/Macro_1.scala +++ b/tests/pos-macros/exprSummonWithTypeVar/Macro_1.scala @@ -2,7 +2,7 @@ import scala.compiletime.{erasedValue, summonFrom} import scala.quoted._ -inline given summonAfterTypeMatch[T]: Any = +inline given summonAfterTypeMatch: [T] => Any = ${ summonAfterTypeMatchExpr[T] } private def summonAfterTypeMatchExpr[T: Type](using Quotes): Expr[Any] = @@ -10,4 +10,4 @@ private def summonAfterTypeMatchExpr[T: Type](using Quotes): Expr[Any] = trait Foo[T] -given IntFoo[T <: Int]: Foo[T] = ??? +given IntFoo: [T <: Int] => Foo[T] = ??? diff --git a/tests/pos-macros/i13021/Width.scala b/tests/pos-macros/i13021/Width.scala index a163e1b5ebf1..60c1b47b99d8 100644 --- a/tests/pos-macros/i13021/Width.scala +++ b/tests/pos-macros/i13021/Width.scala @@ -3,7 +3,7 @@ import scala.quoted.* trait Width[T]: type Out <: Int object Width: - transparent inline given [T]: Width[T] = ${ getWidthMacro[T] } + transparent inline given [T] => Width[T] = ${ getWidthMacro[T] } def getWidthMacro[T](using Quotes, Type[T]): Expr[Width[T]] = '{ new Width[T] { diff --git a/tests/pos-macros/i18228.scala b/tests/pos-macros/i18228.scala index f0b8226fc135..2127ea7686f5 100644 --- a/tests/pos-macros/i18228.scala +++ b/tests/pos-macros/i18228.scala @@ -3,7 +3,7 @@ import scala.quoted.* case class QueryMeta[T](map: Map[String, String]) object QueryMeta: - given [T: Type]: FromExpr[QueryMeta[T]] = new FromExpr[QueryMeta[T]]: + given [T: Type] => FromExpr[QueryMeta[T]] = new FromExpr[QueryMeta[T]]: def unapply(expr: Expr[QueryMeta[T]])(using q: Quotes): Option[QueryMeta[T]] = import q.reflect.* expr match diff --git a/tests/pos-macros/macro-docs.scala b/tests/pos-macros/macro-docs.scala index f3cd6e3ef00a..820aae451486 100644 --- a/tests/pos-macros/macro-docs.scala +++ b/tests/pos-macros/macro-docs.scala @@ -2,12 +2,12 @@ import scala.quoted.* object MacrosMD_ToExpr { - given ToExpr[Boolean] with { + given ToExpr[Boolean] { def apply(b: Boolean)(using Quotes) = if (b) '{ true } else '{ false } } - given ToExpr[Int] with { + given ToExpr[Int] { def apply(n: Int)(using Quotes) = n match { case Int.MinValue => '{ Int.MinValue } case _ if n < 0 => '{ - ${ apply(-n) } } @@ -17,7 +17,7 @@ object MacrosMD_ToExpr { } } - given [T: ToExpr : Type]: ToExpr[List[T]] with { + given [T: ToExpr : Type] => ToExpr[List[T]] { def apply(xs: List[T])(using Quotes) = xs match { case head :: tail => '{ ${ Expr(head) } :: ${ apply(tail) } } case Nil => '{ Nil: List[T] } diff --git a/tests/pos-macros/nil-liftable.scala b/tests/pos-macros/nil-liftable.scala index a3277510d7bf..c95fc7698e5a 100644 --- a/tests/pos-macros/nil-liftable.scala +++ b/tests/pos-macros/nil-liftable.scala @@ -1,7 +1,7 @@ import scala.quoted.* class Test: - given NilToExpr: ToExpr[Nil.type] with { + given NilToExpr: ToExpr[Nil.type] { def apply(xs: Nil.type)(using Quotes): Expr[Nil.type] = '{ Nil } } diff --git a/tests/pos/20088.scala b/tests/pos/20088.scala index 308c5a0f0a91..30651ce9d39c 100644 --- a/tests/pos/20088.scala +++ b/tests/pos/20088.scala @@ -1,6 +1,6 @@ trait Foo trait Bar -given (using foo: Foo = new {}): Bar with {} +given (foo: Foo = new {}) => Bar() def Test = summon[Bar] diff --git a/tests/pos/X.scala b/tests/pos/X.scala index 04150b72beeb..72a14478b4cb 100644 --- a/tests/pos/X.scala +++ b/tests/pos/X.scala @@ -2,8 +2,8 @@ import scala.deriving.* trait FunctorK[F[_[_]]] object FunctorK { - given [C]: FunctorK[[F[_]] =>> C]() - given [T]: FunctorK[[F[_]] =>> Tuple1[F[T]]]() + given [C] => FunctorK[[F[_]] =>> C]() + given [T] => FunctorK[[F[_]] =>> Tuple1[F[T]]]() def derived[F[_[_]]](using m: Mirror { type MirroredType[X[_]] = F[X] ; type MirroredElemTypes[_[_]] }, r: FunctorK[m.MirroredElemTypes]): FunctorK[F] = new FunctorK[F] {} } diff --git a/tests/pos/bson/bson.scala b/tests/pos/bson/bson.scala index d901ee3e3a4f..2a1bc808fbc8 100644 --- a/tests/pos/bson/bson.scala +++ b/tests/pos/bson/bson.scala @@ -7,7 +7,7 @@ object BSONWriter extends BSONWriterInstances trait BSONHandler[T] extends BSONWriter[T] private[bson] trait BSONWriterInstances { - given mapWriter[V](using BSONWriter[V]): BSONDocumentWriter[Map[String, V]] = bson.mapWriter[V] + given mapWriter: [V] => BSONWriter[V] => BSONDocumentWriter[Map[String, V]] = bson.mapWriter[V] export bson.collectionWriter } @@ -21,7 +21,7 @@ object ¬ { private[bson] trait DefaultBSONHandlers extends LowPriorityHandlers private[bson] trait LowPriorityHandlers{ - given collectionWriter[T, Repr <: Iterable[T]](using BSONWriter[T], Repr ¬ Option[T]): BSONWriter[Repr] = ??? + given collectionWriter: [T, Repr <: Iterable[T]] => (BSONWriter[T], Repr ¬ Option[T]) => BSONWriter[Repr] = ??? private[bson] def mapWriter[V](implicit valueWriter: BSONWriter[V]): BSONDocumentWriter[Map[String, V]] = ??? } diff --git a/tests/pos/cbproxy-expansion.scala b/tests/pos/cbproxy-expansion.scala index ee145b62d4ed..bd7788ca0da0 100644 --- a/tests/pos/cbproxy-expansion.scala +++ b/tests/pos/cbproxy-expansion.scala @@ -6,7 +6,7 @@ def f1[S, T: TC[S] as tc](x: S, y: tc.Self) = () def f2[S, T: TC[S]](x: S, y: T.Self) = () def f3[S, T: TC[S]](x: S, y: Int) = () -given TC[String] with +given TC[String]: type Self = Int def unit = 42 diff --git a/tests/pos/combine.scala b/tests/pos/combine.scala index 930e5237e249..c9217e593dc8 100644 --- a/tests/pos/combine.scala +++ b/tests/pos/combine.scala @@ -2,7 +2,7 @@ trait Semigroup[A] { extension (x: A) def combine(y: A): A } given Semigroup[Int] = ??? -given [A, B](using Semigroup[A], Semigroup[B]): Semigroup[(A, B)] = ??? +given [A, B] => (Semigroup[A], Semigroup[B]) => Semigroup[(A, B)] = ??? object Test extends App { ((1, 1)) combine ((2, 2)) // doesn't compile ((1, 1): (Int, Int)) combine (2, 2) // compiles diff --git a/tests/pos/end-given.scala b/tests/pos/end-given.scala index 359d7d1b6a6b..0aacfb379c3c 100644 --- a/tests/pos/end-given.scala +++ b/tests/pos/end-given.scala @@ -1,3 +1,3 @@ -given Conversion[Int, String] with +given Conversion[Int, String]: def apply(x: Int) = "" end given diff --git a/tests/pos/erased-conforms.scala b/tests/pos/erased-conforms.scala index 1f366e0683c6..426490d5a53a 100644 --- a/tests/pos/erased-conforms.scala +++ b/tests/pos/erased-conforms.scala @@ -5,7 +5,7 @@ erased class <::<[-From, +To] extends ErasedTerm erased class =::=[From, To] extends (From <::< To) -erased given [X]: (X =::= X) = scala.compiletime.erasedValue +erased given [X] => (X =::= X) = scala.compiletime.erasedValue extension [From](x: From) inline def cast[To](using From <::< To): To = x.asInstanceOf[To] // Safe cast because we know `From <:< To` diff --git a/tests/pos/ext-override.scala b/tests/pos/ext-override.scala index d08439e13c9a..7c082695cbaa 100644 --- a/tests/pos/ext-override.scala +++ b/tests/pos/ext-override.scala @@ -7,6 +7,6 @@ trait Foo[T]: class Bla: def hi: String = "hi" object Bla: - given Foo[Bla] with + given Foo[Bla]: extension (x: Bla) def hi: String = x.hi diff --git a/tests/pos/givenFallback.scala b/tests/pos/givenFallback.scala index 760eb2b5aed2..12d667af05c1 100644 --- a/tests/pos/givenFallback.scala +++ b/tests/pos/givenFallback.scala @@ -1,13 +1,11 @@ trait TC[T] { def x: Int; def y: Int = 0 } -given [T]: TC[T] with { +given [T] => TC[T]: inline val x = 1 -} -given TC[Int] with { +given TC[Int]: inline val x = 2 inline override val y = 3 -} object Test extends App { val z: 2 = summon[TC[Int]].x diff --git a/tests/pos/hylolib-cb-extract.scala b/tests/pos/hylolib-cb-extract.scala index b80a88485a2b..0ea38d508093 100644 --- a/tests/pos/hylolib-cb-extract.scala +++ b/tests/pos/hylolib-cb-extract.scala @@ -14,5 +14,5 @@ class BitArray given Value[Boolean] {} -given Collection[BitArray] with +given Collection[BitArray]: type Element = Boolean diff --git a/tests/pos/hylolib-cb/AnyCollection.scala b/tests/pos/hylolib-cb/AnyCollection.scala index 50f4313e46ce..61300a7b2bfe 100644 --- a/tests/pos/hylolib-cb/AnyCollection.scala +++ b/tests/pos/hylolib-cb/AnyCollection.scala @@ -42,12 +42,12 @@ object AnyCollection { } -given anyCollectionIsCollection[T: Value]: Collection[AnyCollection[T]] with { +given anyCollectionIsCollection: [T: Value] => Collection[AnyCollection[T]]: type Element = T type Position = AnyValue - extension (self: AnyCollection[T]) { + extension (self: AnyCollection[T]) def startPosition = self._start() @@ -60,7 +60,3 @@ given anyCollectionIsCollection[T: Value]: Collection[AnyCollection[T]] with { def at(p: Position) = self._at(p) - - } - -} diff --git a/tests/pos/hylolib-cb/AnyValue.scala b/tests/pos/hylolib-cb/AnyValue.scala index b9d39869c09a..88709b7b4da2 100644 --- a/tests/pos/hylolib-cb/AnyValue.scala +++ b/tests/pos/hylolib-cb/AnyValue.scala @@ -58,7 +58,7 @@ object AnyValue { } -given anyValueIsValue: Value[AnyValue] with { +given anyValueIsValue: Value[AnyValue] { extension (self: AnyValue) { diff --git a/tests/pos/hylolib-cb/BitArray.scala b/tests/pos/hylolib-cb/BitArray.scala index 3a0b4658f747..0c8f98fb1ba4 100644 --- a/tests/pos/hylolib-cb/BitArray.scala +++ b/tests/pos/hylolib-cb/BitArray.scala @@ -318,7 +318,7 @@ object BitArray { } -given bitArrayPositionIsValue: Value[BitArray.Position] with { +given bitArrayPositionIsValue: Value[BitArray.Position] { extension (self: BitArray.Position) { @@ -335,7 +335,7 @@ given bitArrayPositionIsValue: Value[BitArray.Position] with { } -given bitArrayIsCollection: Collection[BitArray] with { +given bitArrayIsCollection: Collection[BitArray] { type Element = Boolean type Position = BitArray.Position @@ -361,7 +361,7 @@ given bitArrayIsCollection: Collection[BitArray] with { } -given bitArrayIsStringConvertible: StringConvertible[BitArray] with { +given bitArrayIsStringConvertible: StringConvertible[BitArray] { extension (self: BitArray) override def description: String = diff --git a/tests/pos/hylolib-cb/Integers.scala b/tests/pos/hylolib-cb/Integers.scala index b9bc203a88ea..02a0cd6df111 100644 --- a/tests/pos/hylolib-cb/Integers.scala +++ b/tests/pos/hylolib-cb/Integers.scala @@ -1,6 +1,6 @@ package hylo -given booleanIsValue: Value[Boolean] with { +given booleanIsValue: Value[Boolean] { extension (self: Boolean) { @@ -18,7 +18,7 @@ given booleanIsValue: Value[Boolean] with { } -given intIsValue: Value[Int] with { +given intIsValue: Value[Int] { extension (self: Int) { @@ -36,7 +36,7 @@ given intIsValue: Value[Int] with { } -given intIsComparable: Comparable[Int] with { +given intIsComparable: Comparable[Int] { extension (self: Int) { @@ -55,4 +55,4 @@ given intIsComparable: Comparable[Int] with { } -given intIsStringConvertible: StringConvertible[Int] with {} +given intIsStringConvertible: StringConvertible[Int] {} diff --git a/tests/pos/hylolib-cb/Slice.scala b/tests/pos/hylolib-cb/Slice.scala index b577ceeb3739..10d0ffd36fb0 100644 --- a/tests/pos/hylolib-cb/Slice.scala +++ b/tests/pos/hylolib-cb/Slice.scala @@ -24,7 +24,7 @@ final class Slice[Base: Collection as b]( } -given sliceIsCollection[T: Collection as c]: Collection[Slice[T]] with { +given sliceIsCollection: [T: Collection as c] => Collection[Slice[T]] { type Element = c.Element type Position = c.Position diff --git a/tests/pos/hylolib-deferred-given-extract.scala b/tests/pos/hylolib-deferred-given-extract.scala index 02d889dc9aac..220dad944198 100644 --- a/tests/pos/hylolib-deferred-given-extract.scala +++ b/tests/pos/hylolib-deferred-given-extract.scala @@ -13,7 +13,7 @@ trait Collection[Self]: class BitArray -given Value[Boolean] {} +given Value[Boolean]() -given Collection[BitArray] with +given Collection[BitArray]: type Element = Boolean diff --git a/tests/pos/hylolib-deferred-given/AnyCollection.scala b/tests/pos/hylolib-deferred-given/AnyCollection.scala index 55e453d6dc87..e2a946fca484 100644 --- a/tests/pos/hylolib-deferred-given/AnyCollection.scala +++ b/tests/pos/hylolib-deferred-given/AnyCollection.scala @@ -42,7 +42,7 @@ object AnyCollection { } -given anyCollectionIsCollection[T](using tIsValue: Value[T]): Collection[AnyCollection[T]] with { +given anyCollectionIsCollection: [T] => (tIsValue: Value[T]) => Collection[AnyCollection[T]] { type Element = T //given elementIsValue: Value[Element] = tIsValue diff --git a/tests/pos/hylolib-deferred-given/AnyValue.scala b/tests/pos/hylolib-deferred-given/AnyValue.scala index 21f2965e102e..5c1b68a52366 100644 --- a/tests/pos/hylolib-deferred-given/AnyValue.scala +++ b/tests/pos/hylolib-deferred-given/AnyValue.scala @@ -58,7 +58,7 @@ object AnyValue { } -given anyValueIsValue: Value[AnyValue] with { +given anyValueIsValue: Value[AnyValue] { extension (self: AnyValue) { diff --git a/tests/pos/hylolib-deferred-given/BitArray.scala b/tests/pos/hylolib-deferred-given/BitArray.scala index 485f30472847..d653f5e4d630 100644 --- a/tests/pos/hylolib-deferred-given/BitArray.scala +++ b/tests/pos/hylolib-deferred-given/BitArray.scala @@ -318,7 +318,7 @@ object BitArray { } -given bitArrayPositionIsValue: Value[BitArray.Position] with { +given bitArrayPositionIsValue: Value[BitArray.Position] { extension (self: BitArray.Position) { @@ -335,7 +335,7 @@ given bitArrayPositionIsValue: Value[BitArray.Position] with { } -given bitArrayIsCollection: Collection[BitArray] with { +given bitArrayIsCollection: Collection[BitArray] { type Element = Boolean //given elementIsValue: Value[Boolean] = booleanIsValue @@ -364,7 +364,7 @@ given bitArrayIsCollection: Collection[BitArray] with { } -given bitArrayIsStringConvertible: StringConvertible[BitArray] with { +given bitArrayIsStringConvertible: StringConvertible[BitArray] { extension (self: BitArray) override def description: String = diff --git a/tests/pos/hylolib-deferred-given/HyArray.scala b/tests/pos/hylolib-deferred-given/HyArray.scala index 98632dcb65bc..e82ce06d920b 100644 --- a/tests/pos/hylolib-deferred-given/HyArray.scala +++ b/tests/pos/hylolib-deferred-given/HyArray.scala @@ -162,7 +162,7 @@ object HyArray { } -given hyArrayIsValue[T](using tIsValue: Value[T]): Value[HyArray[T]] with { +given hyArrayIsValue: [T] => (tIsValue: Value[T]) => Value[HyArray[T]] { extension (self: HyArray[T]) { @@ -179,7 +179,7 @@ given hyArrayIsValue[T](using tIsValue: Value[T]): Value[HyArray[T]] with { } -given hyArrayIsCollection[T](using tIsValue: Value[T]): Collection[HyArray[T]] with { +given hyArrayIsCollection: [T] => (tIsValue: Value[T]) => Collection[HyArray[T]] { type Element = T //given elementIsValue: Value[T] = tIsValue diff --git a/tests/pos/hylolib-deferred-given/Integers.scala b/tests/pos/hylolib-deferred-given/Integers.scala index b9bc203a88ea..02a0cd6df111 100644 --- a/tests/pos/hylolib-deferred-given/Integers.scala +++ b/tests/pos/hylolib-deferred-given/Integers.scala @@ -1,6 +1,6 @@ package hylo -given booleanIsValue: Value[Boolean] with { +given booleanIsValue: Value[Boolean] { extension (self: Boolean) { @@ -18,7 +18,7 @@ given booleanIsValue: Value[Boolean] with { } -given intIsValue: Value[Int] with { +given intIsValue: Value[Int] { extension (self: Int) { @@ -36,7 +36,7 @@ given intIsValue: Value[Int] with { } -given intIsComparable: Comparable[Int] with { +given intIsComparable: Comparable[Int] { extension (self: Int) { @@ -55,4 +55,4 @@ given intIsComparable: Comparable[Int] with { } -given intIsStringConvertible: StringConvertible[Int] with {} +given intIsStringConvertible: StringConvertible[Int] {} diff --git a/tests/pos/hylolib-deferred-given/Slice.scala b/tests/pos/hylolib-deferred-given/Slice.scala index 57cdb38f6e53..234b16dfc428 100644 --- a/tests/pos/hylolib-deferred-given/Slice.scala +++ b/tests/pos/hylolib-deferred-given/Slice.scala @@ -26,7 +26,7 @@ final class Slice[Base](using } -given sliceIsCollection[T](using c: Collection[T]): Collection[Slice[T]] with { +given sliceIsCollection: [T] => (c: Collection[T]) => Collection[Slice[T]] { type Element = c.Element //given elementIsValue: Value[Element] = c.elementIsValue diff --git a/tests/pos/i10259.scala b/tests/pos/i10259.scala index 101a3d869a04..e8da9e6a7be7 100644 --- a/tests/pos/i10259.scala +++ b/tests/pos/i10259.scala @@ -4,7 +4,7 @@ trait S[T] extends (T => T): def apply(x: T) = ??? extension (x: T) def show: String -given S[Int] with +given S[Int]: extension (x: Int) def show = x.toString val x = 10.show diff --git a/tests/pos/i10929.scala b/tests/pos/i10929.scala index e916e4547e59..358de9ce30a8 100644 --- a/tests/pos/i10929.scala +++ b/tests/pos/i10929.scala @@ -5,11 +5,11 @@ infix abstract class TupleOf[T, +A]: object TupleOf: - given TupleOf[EmptyTuple, Nothing] with + given TupleOf[EmptyTuple, Nothing]: type Mapped[+A] = EmptyTuple def map[B](x: EmptyTuple)(f: Nothing => B): Mapped[B] = x - given [A, Rest <: Tuple](using tracked val tup: Rest TupleOf A): TupleOf[A *: Rest, A] with + given [A, Rest <: Tuple] => (tracked val tup: Rest TupleOf A) => TupleOf[A *: Rest, A]: type Mapped[+A] = A *: tup.Mapped[A] def map[B](x: A *: Rest)(f: A => B): Mapped[B] = (f(x.head) *: tup.map(x.tail)(f)) diff --git a/tests/pos/i11174minimisation.scala b/tests/pos/i11174minimisation.scala index c40c34552bb8..7e0aa42721bf 100644 --- a/tests/pos/i11174minimisation.scala +++ b/tests/pos/i11174minimisation.scala @@ -20,6 +20,6 @@ object EnumerateNames { class MainClass { enum Shape: case Point - inline given auto[T]: EnumerateNames[T] = EnumerateNames.derived[T] + inline given auto: [T] => EnumerateNames[T] = EnumerateNames.derived[T] def shapeNames: EnumerateNames[Shape] = EnumerateNames.derived[Shape] } \ No newline at end of file diff --git a/tests/pos/i11175.scala b/tests/pos/i11175.scala index bfefe84dde95..5a6f9fe852bb 100644 --- a/tests/pos/i11175.scala +++ b/tests/pos/i11175.scala @@ -10,10 +10,10 @@ object A object B -given Printer[A.type] with +given Printer[A.type]: def print(a:A.type):String = "a" -given Printer[B.type] with +given Printer[B.type]: def print(b:B.type):String = "b" diff --git a/tests/pos/i11243.scala b/tests/pos/i11243.scala index 7966df0c8243..42294ed5bf76 100644 --- a/tests/pos/i11243.scala +++ b/tests/pos/i11243.scala @@ -54,7 +54,7 @@ object WriterTest extends App { end Monad - given eitherMonad[Err]: Monad[[X] =>> Either[Err,X]] with + given eitherMonad: [Err] => Monad[[X] =>> Either[Err,X]]: def pure[A](a: A): Either[Err, A] = Right(a) extension [A,B](x: Either[Err,A]) def flatMap(f: A => Either[Err, B]) = { x match { @@ -63,7 +63,7 @@ object WriterTest extends App { } } - given optionMonad: Monad[Option] with + given optionMonad: Monad[Option]: def pure[A](a: A) = Some(a) extension[A,B](fa: Option[A]) def flatMap(f: A => Option[B]) = { @@ -75,7 +75,7 @@ object WriterTest extends App { } } - given listMonad: Monad[List] with + given listMonad: Monad[List]: def pure[A](a: A): List[A] = List(a) extension[A,B](x: List[A]) @@ -88,7 +88,7 @@ object WriterTest extends App { case class Transformer[F[_]: Monad,A](val wrapped: F[A]) - given transformerMonad[F[_]: Monad]: Monad[[X] =>> Transformer[F,X]] with { + given transformerMonad: [F[_]: Monad] => Monad[[X] =>> Transformer[F,X]] { def pure[A](a: A): Transformer[F,A] = Transformer(summon[Monad[F]].pure(a)) diff --git a/tests/pos/i11538a.scala b/tests/pos/i11538a.scala index 243900c43b44..51ecdb227ab9 100644 --- a/tests/pos/i11538a.scala +++ b/tests/pos/i11538a.scala @@ -3,7 +3,7 @@ package a: trait Printer[A]: def print(a: A): Unit - given Printer[String] with + given Printer[String]: def print(s: String) = println(s) package b: diff --git a/tests/pos/i11732.scala b/tests/pos/i11732.scala index a1138a94fcd7..c8c74eccc51b 100644 --- a/tests/pos/i11732.scala +++ b/tests/pos/i11732.scala @@ -6,7 +6,7 @@ trait TupleConversion[A, B] { } object TupleConversion { - inline given autoTupleConversion[Prod <: Product](using m: Mirror.ProductOf[Prod]): TupleConversion[Prod, m.MirroredElemTypes] = + inline given autoTupleConversion: [Prod <: Product] => (m: Mirror.ProductOf[Prod]) => TupleConversion[Prod, m.MirroredElemTypes] = new TupleConversion[Prod, m.MirroredElemTypes] { def to(a: Prod): m.MirroredElemTypes = Tuple.fromProductTyped(a) def from(b: m.MirroredElemTypes): Prod = m.fromProduct(b) diff --git a/tests/pos/i11864.scala b/tests/pos/i11864.scala index 4f7735f1c8c5..ba43336e13ca 100644 --- a/tests/pos/i11864.scala +++ b/tests/pos/i11864.scala @@ -40,7 +40,7 @@ final class CallbackTo[+A] { object CallbackTo { type MapGuard[A] = { type Out = A } - erased given MapGuard[A]: MapGuard[A] = compiletime.erasedValue + erased given MapGuard: [A] => MapGuard[A] = compiletime.erasedValue def traverse[A, B](ta: List[A]): CallbackTo[List[B]] = val x: CallbackTo[List[A] => List[B]] = ??? diff --git a/tests/pos/i12126.scala b/tests/pos/i12126.scala index cffa7fbcbbca..aac2f39d4d95 100644 --- a/tests/pos/i12126.scala +++ b/tests/pos/i12126.scala @@ -22,12 +22,12 @@ object Structures: def map2[B, C](fb: F[B], f: (A, B) => C): F[C] = flatMap(a => fb.map(b => f(a, b))) - given Monad[List] with + given Monad[List]: def pure[A](a: A) = List(a) extension[A](fa: List[A]) def flatMap[B](f: A => List[B]) = fa.flatMap(f) - given Monad[Option] with + given Monad[Option]: def pure[A](a: A) = Some(a) extension[A](fa: Option[A]) def flatMap[B](f: A => Option[B]) = fa.flatMap(f) @@ -41,7 +41,7 @@ object Structures: object Kleisli: def apply[F[_], A, B](f: A => F[B]): Kleisli[F, A, B] = f - given [F[_], A](using F: Monad[F]): Monad[[B] =>> Kleisli[F, A, B]] with + given [F[_], A] => (F: Monad[F]) => Monad[[B] =>> Kleisli[F, A, B]]: def pure[B](b: B) = Kleisli(_ => F.pure(b)) extension[B](k: Kleisli[F, A, B]) def flatMap[C](f: B => Kleisli[F, A, C]) = diff --git a/tests/pos/i12379b.scala b/tests/pos/i12379b.scala index 2a83f69bae3d..6586f7b85a42 100644 --- a/tests/pos/i12379b.scala +++ b/tests/pos/i12379b.scala @@ -4,7 +4,7 @@ inline def convFail[Of, From](inline from : From) : Unit = inline def convOK[Of, From](inline from : From)(using c : Conversion[From, Of]) : Unit = {} class Bar[T](value : T) -given [T <: Int] : Conversion[T, Bar[T]] = Bar(_) +given [T <: Int] => Conversion[T, Bar[T]] = Bar(_) @main def main : Unit = { convOK[Bar[1],1](1) diff --git a/tests/pos/i12591/Inner.scala b/tests/pos/i12591/Inner.scala index 2f8018c4d824..a0b3e2f6410d 100644 --- a/tests/pos/i12591/Inner.scala +++ b/tests/pos/i12591/Inner.scala @@ -4,7 +4,7 @@ package inner sealed trait Foo object Foo: trait TC[T] - given ofFoo[T <: Foo]: TC[T] = ??? + given ofFoo: [T <: Foo] => TC[T] = ??? trait Bar extends Foo import Foo.TC diff --git a/tests/pos/i12910.scala b/tests/pos/i12910.scala index e78408aa5e5f..4c0d4ac369e1 100644 --- a/tests/pos/i12910.scala +++ b/tests/pos/i12910.scala @@ -3,7 +3,7 @@ trait Type[T]: type varchar -given Type[varchar] with +given Type[varchar]: type Out = String class Placeholder[T, U] @@ -17,7 +17,7 @@ trait Encoder[P, X]: object Encoder: def apply[P, X](placeholder: P)(using e: Encoder[P, X]): X => String = e.encode - given [T, X]: Encoder[Placeholder[T, X], X] with + given [T, X] => Encoder[Placeholder[T, X], X]: def encode(x: X): String = ??? def Test = diff --git a/tests/pos/i12945/A_1.scala b/tests/pos/i12945/A_1.scala index 890171a63051..62519fde262b 100644 --- a/tests/pos/i12945/A_1.scala +++ b/tests/pos/i12945/A_1.scala @@ -3,7 +3,7 @@ object Lie: trait TC[-T]: type Out object TC: - given [W <: Int]: TC[Lie[W]] with + given [W <: Int] => TC[Lie[W]]: type Out = W val x = summon[Lie.TC[Lie[7]]] diff --git a/tests/pos/i12949.scala b/tests/pos/i12949.scala index 5a886aa894b3..71a8ce67d032 100644 --- a/tests/pos/i12949.scala +++ b/tests/pos/i12949.scala @@ -6,11 +6,11 @@ object Catch22: object Hodor: object TC: import Catch22.TC - given fromString[V <: String]: TC[V] = ??? - transparent inline given fromDouble[V <: Double]: TC[V] = + given fromString: [V <: String] => TC[V] = ??? + transparent inline given fromDouble: [V <: Double] => TC[V] = new TC[V]: type Out = Double - given fromInt[V <: Int]: TC[V] with + given fromInt: [V <: Int] => TC[V]: type Out = Int object Test: diff --git a/tests/pos/i13001/Main_1.scala b/tests/pos/i13001/Main_1.scala index ad46df9f2fe1..9cdce20ef3bf 100644 --- a/tests/pos/i13001/Main_1.scala +++ b/tests/pos/i13001/Main_1.scala @@ -4,13 +4,13 @@ trait Arbitrary[T] trait Gen[+T] object ArbitraryDerivation: - given deriveArb[A](using gen: DerivedGen[A]): Arbitrary[A] = ??? + given deriveArb: [A] => (gen: DerivedGen[A]) => Arbitrary[A] = ??? opaque type DerivedGen[A] = Gen[A] object DerivedGen extends DerivedGenInstances sealed abstract class DerivedGenInstances: - inline given derived[A](using gen: K0.Generic[A]): DerivedGen[A] = + inline given derived: [A] => (gen: K0.Generic[A]) => DerivedGen[A] = val dummy: DerivedGen[A] = ??? gen.derive(dummy, dummy) diff --git a/tests/pos/i13044.scala b/tests/pos/i13044.scala index 36299d9e8366..ce483b4a403c 100644 --- a/tests/pos/i13044.scala +++ b/tests/pos/i13044.scala @@ -36,7 +36,7 @@ trait SchemaDerivation { } } - inline given gen[A]: Schema[A] = derived + inline given gen: [A] => Schema[A] = derived } case class H(i: Int) diff --git a/tests/pos/i13460.scala b/tests/pos/i13460.scala index fd57cd9b8521..90b2a9aff1fe 100644 --- a/tests/pos/i13460.scala +++ b/tests/pos/i13460.scala @@ -5,7 +5,7 @@ class Lazy[A](obj: => A) { lazy val value: A = obj } object Lazy { - given [A](using obj: => A ): Lazy[A] = new Lazy(obj) + given [A] => (obj: => A) => Lazy[A] = new Lazy(obj) } trait MyTypeClass[A] { @@ -13,10 +13,10 @@ trait MyTypeClass[A] { } object MyTypeClass { - given IntTypeClass: MyTypeClass[Int] with + given IntTypeClass: MyTypeClass[Int]: def makeString(a: Int): String = a.toString - inline given derived[A](using m: Mirror.Of[A]): MyTypeClass[A] = + inline given derived: [A] => (m: Mirror.Of[A]) => MyTypeClass[A] = inline m match case p: Mirror.ProductOf[A] => productConverter(p) diff --git a/tests/pos/i13503.scala b/tests/pos/i13503.scala index c60b0e05862c..020ba437e141 100644 --- a/tests/pos/i13503.scala +++ b/tests/pos/i13503.scala @@ -1,5 +1,5 @@ trait First {type Out} -given First with {type Out = 123} +given First {type Out = 123} trait Second {type Out} transparent inline given (using f: First): Second = new Second {type Out = f.Out} diff --git a/tests/pos/i13668.scala b/tests/pos/i13668.scala index 2199e0eb82c5..aebdd0478407 100644 --- a/tests/pos/i13668.scala +++ b/tests/pos/i13668.scala @@ -1,6 +1,6 @@ class MyType() trait Candidate[R] -given Candidate[MyType] with {} +given Candidate[MyType]() class Fuzzy[W]() class Fuzzy1() class Bear() diff --git a/tests/pos/i13900.scala b/tests/pos/i13900.scala index e6197d7f3f33..8b23fc2bdc20 100644 --- a/tests/pos/i13900.scala +++ b/tests/pos/i13900.scala @@ -3,10 +3,10 @@ import scala.annotation.targetName opaque type Inlined[T] = T object Inlined: extension [T](inlined: Inlined[T]) def value: T = inlined - inline given fromValue[T <: Singleton]: Conversion[T, Inlined[T]] = + inline given fromValue: [T <: Singleton] => Conversion[T, Inlined[T]] = value => value @targetName("fromValueWide") - given fromValue[Wide]: Conversion[Wide, Inlined[Wide]] = value => value + given fromValue: [Wide] => Conversion[Wide, Inlined[Wide]] = value => value def forced[T](value: Any): Inlined[T] = value.asInstanceOf[T] extension [T <: Int](lhs: Inlined[T]) diff --git a/tests/pos/i14013.scala b/tests/pos/i14013.scala index d20112392002..e1a586af9d45 100644 --- a/tests/pos/i14013.scala +++ b/tests/pos/i14013.scala @@ -47,7 +47,7 @@ object App2 extends App { object Foo2 { case class Bar(i: Int) - private given BarOps: AnyRef with { + private given BarOps: AnyRef { extension (bar: Bar) def twice: Bar = Bar(bar.i * 2) } diff --git a/tests/pos/i14177b.scala b/tests/pos/i14177b.scala index 6da9a72ae551..4d3810116617 100644 --- a/tests/pos/i14177b.scala +++ b/tests/pos/i14177b.scala @@ -1,15 +1,15 @@ class T -inline given fail1: T with +inline given fail1: T: val cs = scala.compiletime.summonAll[EmptyTuple] -inline given fail2[X]: T with +inline given fail2: [X] => T: val cs = scala.compiletime.summonAll[EmptyTuple] -inline given fail3(using DummyImplicit): T with +inline given fail3: () => T: val cs = scala.compiletime.summonAll[EmptyTuple] inline given ok1: T = new T: val cs = scala.compiletime.summonAll[EmptyTuple] -inline given ok2[X]: T = new T: +inline given ok2: [X] => T = new T: val cs = scala.compiletime.summonAll[EmptyTuple] -inline given ok3(using DummyImplicit): T = new T: +inline given ok3: () => T = new T: val cs = scala.compiletime.summonAll[EmptyTuple] diff --git a/tests/pos/i14282.scala b/tests/pos/i14282.scala index 2cc3ff1226e2..2dd768183124 100644 --- a/tests/pos/i14282.scala +++ b/tests/pos/i14282.scala @@ -2,12 +2,12 @@ trait Foo[A] { inline def foo(): Unit } -inline given FooA[A]: Foo[A] with { +inline given FooA: [A] => Foo[A]: inline def foo(): Unit = println() -} + def test1 = FooA.foo() -inline given FooInt: Foo[Int] with { +inline given FooInt: Foo[Int]: inline def foo(): Unit = println() -} + def test2 = FooInt.foo() diff --git a/tests/pos/i14637.scala b/tests/pos/i14637.scala index 5ae3b5e7a881..512471f7b19a 100644 --- a/tests/pos/i14637.scala +++ b/tests/pos/i14637.scala @@ -3,6 +3,6 @@ class C object Givens: - given cOrdering: Ordering[C] with + given cOrdering: Ordering[C]: override def compare(c0: C, c1: C) = 0 val greeting = "we love Givens" \ No newline at end of file diff --git a/tests/pos/i15160.scala b/tests/pos/i15160.scala index cc55e0f5fb19..bef59f3c9d80 100644 --- a/tests/pos/i15160.scala +++ b/tests/pos/i15160.scala @@ -2,7 +2,7 @@ trait Eq[A] { def eqv(a1: A, a2: A): Boolean } -given stringEq: Eq[String] with { +given stringEq: Eq[String] { def eqv(a1: String, a2: String) = a1 == a2 } diff --git a/tests/pos/i15177.hylolib.scala b/tests/pos/i15177.hylolib.scala index 96cf87680a1c..be2f5900094b 100644 --- a/tests/pos/i15177.hylolib.scala +++ b/tests/pos/i15177.hylolib.scala @@ -6,6 +6,6 @@ trait Coll[Self]: extension (self: Self) def pos: Pos extension [Self: Coll](self: Self) def trigger = self.pos class Slice[Base] -given SliceIsColl[T: Coll as c]: Coll[Slice[T]] with +given SliceIsColl: [T: Coll as c] => Coll[Slice[T]]: type Pos = c.Pos extension (self: Slice[T]) def pos: Pos = ??? diff --git a/tests/pos/i15183/decoder_1.scala b/tests/pos/i15183/decoder_1.scala index 532fd7246c3a..fd8f21deffed 100644 --- a/tests/pos/i15183/decoder_1.scala +++ b/tests/pos/i15183/decoder_1.scala @@ -4,11 +4,11 @@ sealed trait Decoder[T] object Decoder { given Decoder[Double] = ??? - inline given summonEmptyTuple[H]: Tuple.Map[EmptyTuple.type, Decoder] = + inline given summonEmptyTuple: [H] => Tuple.Map[EmptyTuple.type, Decoder] = EmptyTuple - inline given summonTuple[H, T <: Tuple](using hd: Decoder[H], td: Tuple.Map[T, Decoder]): Tuple.Map[H *: T, Decoder] = + inline given summonTuple: [H, T <: Tuple] => (hd: Decoder[H], td: Tuple.Map[T, Decoder]) => Tuple.Map[H *: T, Decoder] = hd *: td - inline given derived[T](using m: Mirror.Of[T], d: Tuple.Map[m.MirroredElemTypes, Decoder]): Decoder[T] = ??? + inline given derived: [T] => (m: Mirror.Of[T], d: Tuple.Map[m.MirroredElemTypes, Decoder]) => Decoder[T] = ??? } diff --git a/tests/pos/i15264.scala b/tests/pos/i15264.scala index 18ca92df6cb1..57036393b90a 100644 --- a/tests/pos/i15264.scala +++ b/tests/pos/i15264.scala @@ -36,9 +36,9 @@ object repro: given gc: C[Int] = new C[Int] // these seem like they should work but don't - given gcq[V](using p0: priority.Prio0)(using c: C[V]): C[Q[V]] = new C[Q[V]] - given gbq[V](using p1: priority.Prio1)(using b: B[V]): B[Q[V]] = new B[Q[V]] - given gaq[V](using p2: priority.Prio2)(using a: A[V]): A[Q[V]] = new A[Q[V]] + given gcq: [V] => priority.Prio0 => C[V] => C[Q[V]] = new C[Q[V]] + given gbq: [V] => priority.Prio1 => B[V] => B[Q[V]] = new B[Q[V]] + given gaq: [V] => priority.Prio2 => A[V] => A[Q[V]] = new A[Q[V]] object test1: import repro.* diff --git a/tests/pos/i15331.scala b/tests/pos/i15331.scala index faf9992cb4f2..337493e73f05 100644 --- a/tests/pos/i15331.scala +++ b/tests/pos/i15331.scala @@ -4,7 +4,7 @@ object Test: trait Arrow {type Dom; type Codom} - given composeArrows[A, Arr1 <: Arrow, Arr2 <: Arrow]: Composable[Arr1 {type Dom = A}, Arr2 {type Codom = A}] with + given composeArrows: [A, Arr1 <: Arrow, Arr2 <: Arrow] => Composable[Arr1 {type Dom = A}, Arr2 {type Codom = A}]: def compose(a: Arr1 {type Dom = A}, b: Arr2 {type Codom = A}): Arrow {type Dom = b.Dom; type Codom = a.Codom} = ??? object arr1 extends Arrow { type Dom = Int; type Codom = Int} diff --git a/tests/pos/i15664.scala b/tests/pos/i15664.scala index 7db8fe8cf23f..7b00e9ec7e85 100644 --- a/tests/pos/i15664.scala +++ b/tests/pos/i15664.scala @@ -11,7 +11,7 @@ sealed abstract class ZManaged[-R, +E, +A] type RManaged[-R, +A] = ZManaged[R, Throwable, A] type ForZManaged[R, E] = [X] =>> ZManaged[R, E, X] -given zManagedCpsMonad[R, E]: CpsMonadInstanceContext[ForZManaged[R, E]] = ??? +given zManagedCpsMonad: [R, E] => CpsMonadInstanceContext[ForZManaged[R, E]] = ??? // Usage def failing[R, E](using diff --git a/tests/pos/i15670.scala b/tests/pos/i15670.scala index b46b3708fe4e..c07290321b20 100644 --- a/tests/pos/i15670.scala +++ b/tests/pos/i15670.scala @@ -5,8 +5,8 @@ trait Read[T] trait Codec[T] extends Read[T] trait CodecTypeProjection[C[_]] object JsonTransform { - given SetCodec[T, C[_]: CodecTypeProjection]: scala.Conversion[C[T], C[Set[T]]] = ??? - given SetCodecExp[T, C[_]: CodecTypeProjection](using codec: C[T]): C[Set[T]] = codec + given SetCodec: [T, C[_]: CodecTypeProjection] => scala.Conversion[C[T], C[Set[T]]] = ??? + given SetCodecExp: [T, C[_]: CodecTypeProjection] => (codec: C[T]) => C[Set[T]] = codec given Codec[String] = ??? given CodecTypeProjection[Read] = ??? } diff --git a/tests/pos/i15867.scala b/tests/pos/i15867.scala index 2e62177ba590..b4f552c6b8c5 100644 --- a/tests/pos/i15867.scala +++ b/tests/pos/i15867.scala @@ -4,7 +4,7 @@ enum SUB[-A, +B]: class Pow(self: Int): def **(other: Int): Int = math.pow(self, other).toInt -given fromList[T]: Conversion[List[T], Pow] = ??? +given fromList: [T] => Conversion[List[T], Pow] = ??? given fromInt: Conversion[Int, Pow] = Pow(_) diff --git a/tests/pos/i15867.specs2.scala b/tests/pos/i15867.specs2.scala index da89b2cba9f0..1e519169d868 100644 --- a/tests/pos/i15867.specs2.scala +++ b/tests/pos/i15867.specs2.scala @@ -1,5 +1,5 @@ class Foo: - given Conversion[String, Data] with + given Conversion[String, Data]: def apply(str: String): Data = new Data(str) class Data(str: String): diff --git a/tests/pos/i16104.scala b/tests/pos/i16104.scala index 7624d5c68a4a..16f935d0e641 100644 --- a/tests/pos/i16104.scala +++ b/tests/pos/i16104.scala @@ -8,7 +8,7 @@ def Case2 = { object WriteOf: final inline def tuple[T <: Tuple]: Write[T] = ??? - given EntryToJson[T]: scala.Conversion[T, JsonStructureEntry[T]] = ??? + given EntryToJson: [T] => scala.Conversion[T, JsonStructureEntry[T]] = ??? class JsonStructureEntry[T](t: T): def writeAs[X >: T](using Write[X]): util.Try[JsonVal] = ??? diff --git a/tests/pos/i16596.more.scala b/tests/pos/i16596.more.scala index 2470eb9eb3c2..c3cb0800be61 100644 --- a/tests/pos/i16596.more.scala +++ b/tests/pos/i16596.more.scala @@ -7,7 +7,7 @@ object NatExample { case class Succ[N <: Nat](prev: N) extends Nat given zero: Zero.type = Zero - given buildSucc[N <: Nat](using n: N): Succ[N] = Succ(n) + given buildSucc: [N <: Nat] => (n: N) => Succ[N] = Succ(n) def value[N <: Nat](using n: N): N = n diff --git a/tests/pos/i17002.scala b/tests/pos/i17002.scala index d33c1bd386d9..f0382f72b7eb 100644 --- a/tests/pos/i17002.scala +++ b/tests/pos/i17002.scala @@ -7,4 +7,4 @@ class Test object Test: @methOnly - given test2[T]: Test with {} + given test2: [T] => Test() diff --git a/tests/pos/i18062.scala b/tests/pos/i18062.scala index 48863c4349c7..d638f7449972 100644 --- a/tests/pos/i18062.scala +++ b/tests/pos/i18062.scala @@ -7,7 +7,7 @@ object WrapperConvert: implicit def id[F[_]]: WrapperConvert[F, F] = new WrapperConvert[F, F]: def conv[X](fx: F[X]): F[X] = fx -transparent inline given convertX[F[_], X](using wc: WrapperConvert[F, CB]): Conversion[F[X], X] = +transparent inline given convertX: [F[_], X] => (wc: WrapperConvert[F, CB]) => Conversion[F[X], X] = new Conversion[F[X], X]: def apply(fx: F[X]) = wc.conv(fx).get diff --git a/tests/pos/i18175.scala b/tests/pos/i18175.scala index 2480ddccc320..76879c10fb39 100644 --- a/tests/pos/i18175.scala +++ b/tests/pos/i18175.scala @@ -10,8 +10,8 @@ object Regex: abstract class Sanitizer[T] object Sanitizer: given Sanitizer[EmptyTuple] = ??? - given stringcase[T <: Tuple: Sanitizer]: Sanitizer[String *: T] = ??? - given optioncase[T <: Tuple: Sanitizer]: Sanitizer[Option[String] *: T] = ??? + given stringcase: [T <: Tuple: Sanitizer] => Sanitizer[String *: T] = ??? + given optioncase: [T <: Tuple: Sanitizer] => Sanitizer[Option[String] *: T] = ??? given Sanitizer[String] = ??? given Sanitizer[Option[String]] = ??? diff --git a/tests/pos/i18211.scala b/tests/pos/i18211.scala index c5ec30ba5d61..45a51932adce 100644 --- a/tests/pos/i18211.scala +++ b/tests/pos/i18211.scala @@ -21,7 +21,7 @@ object Indexes { next: Indexes[A, Tuple.Drop[T, S[IndexOf[A, T]]]] ): Indexes[A, T] = ??? - given empty[A, T <: Tuple](using IndexOf[A, T] =:= -1): Indexes[A, T] = ??? + given empty: [A, T <: Tuple] => (IndexOf[A, T] =:= -1) => Indexes[A, T] = ??? } class GetAll[A]: diff --git a/tests/pos/i18253.orig.scala b/tests/pos/i18253.orig.scala index 9efe1224ebfd..0eaf93ed9ac4 100644 --- a/tests/pos/i18253.orig.scala +++ b/tests/pos/i18253.orig.scala @@ -4,7 +4,7 @@ trait DFSInt[W <: Int] trait Candidate[R]: type OutW <: Int object Candidate: - given [W <: Int, R <: DFSInt[W]]: Candidate[R] with + given [W <: Int, R <: DFSInt[W]] => Candidate[R]: type OutW = W def foo[R](rhs: R)(using icR: Candidate[R]): DFSInt[Max[8, icR.OutW]] = ??? diff --git a/tests/pos/i18253.scala b/tests/pos/i18253.scala index 8f395ee8e943..c9d043a8804d 100644 --- a/tests/pos/i18253.scala +++ b/tests/pos/i18253.scala @@ -4,7 +4,7 @@ trait Foo[A] trait Bar[B]: type Out <: Int object Bar: - given inst[C <: Int]: Bar[C] with + given [C <: Int] => Bar[C]: type Out = C class Test: diff --git a/tests/pos/i18261.min/Main_0.scala b/tests/pos/i18261.min/Main_0.scala index 23d7cbe28198..4d8f79ca241c 100644 --- a/tests/pos/i18261.min/Main_0.scala +++ b/tests/pos/i18261.min/Main_0.scala @@ -2,4 +2,4 @@ type Id[T] = Any match { case Any => T } class Foo[A] object Foo: - given inst[X, Y <: Id[X]]: Foo[Y] = new Foo[Y] + given inst: [X, Y <: Id[X]] => Foo[Y] = new Foo[Y] diff --git a/tests/pos/i18261/DFBits_0.scala b/tests/pos/i18261/DFBits_0.scala index 63b5abb495ef..bbdf871fefb4 100644 --- a/tests/pos/i18261/DFBits_0.scala +++ b/tests/pos/i18261/DFBits_0.scala @@ -3,5 +3,5 @@ trait DFBits[W <: Int] trait Candidate[R]: type OutW <: Int object Candidate: - given [W <: Int, R <: Foo[DFBits[W]]]: Candidate[R] with + given [W <: Int, R <: Foo[DFBits[W]]] => Candidate[R]: type OutW = W diff --git a/tests/pos/i18276a.scala b/tests/pos/i18276a.scala index 46c2722fd8be..eb92066715ef 100644 --- a/tests/pos/i18276a.scala +++ b/tests/pos/i18276a.scala @@ -11,5 +11,5 @@ class ParsersBase { abstract class Parser[+T]: def map[U](f: T => U): Parser[U] = ??? - given [A, B, X]: Conversion[(A, B) => X, (A ~ B) => X] = ??? + given [A, B, X] => Conversion[(A, B) => X, (A ~ B) => X] = ??? } diff --git a/tests/pos/i19404.scala b/tests/pos/i19404.scala index 8d6d4406ebb2..d57027bc46e0 100644 --- a/tests/pos/i19404.scala +++ b/tests/pos/i19404.scala @@ -1,4 +1,4 @@ -given ipEncoder[IP <: IpAddress]: Encoder[IP] = Encoder[String].contramap(_.toString) +given ipEncoder: [IP <: IpAddress] => Encoder[IP] = Encoder[String].contramap(_.toString) class Encoder[A] { final def contramap[B](f: B => A): Encoder[B] = new Encoder[B] diff --git a/tests/pos/i19407.scala b/tests/pos/i19407.scala index b7440a53540d..11c8e746ac43 100644 --- a/tests/pos/i19407.scala +++ b/tests/pos/i19407.scala @@ -6,6 +6,6 @@ object Decoder: object GeneratedEnumDecoder: - given [A <: GeneratedEnum]: Decoder[A] = + given [A <: GeneratedEnum] => Decoder[A] = summon[Decoder[Int]] ??? \ No newline at end of file diff --git a/tests/pos/i19623.scala b/tests/pos/i19623.scala index 8ab8cde159a9..ca3e6b0806e2 100644 --- a/tests/pos/i19623.scala +++ b/tests/pos/i19623.scala @@ -22,7 +22,7 @@ trait RecordLike[R] { val r: %{ val name: String; } = ??? // originally derived in macro, use dummy instance instead - transparent inline given outputRecordLike[R <: %]: RecordLike[R] = null.asInstanceOf[ + transparent inline given outputRecordLike: [R <: %] => RecordLike[R] = null.asInstanceOf[ RecordLike[R] { type ElemTypes = String *: EmptyTuple } diff --git a/tests/pos/i19724.scala b/tests/pos/i19724.scala index 776cf9167890..3054a2541850 100644 --- a/tests/pos/i19724.scala +++ b/tests/pos/i19724.scala @@ -1,5 +1,5 @@ object repro: abstract class Mapper[A, B] extends (A => B) - given Mapper[Int, Double] with + given Mapper[Int, Double]: inline def apply(v: Int): Double = v.toDouble diff --git a/tests/pos/i19749.scala b/tests/pos/i19749.scala index 367c5f61bdce..bbffe3a94961 100644 --- a/tests/pos/i19749.scala +++ b/tests/pos/i19749.scala @@ -5,7 +5,7 @@ case class A(x: Int, y: String) trait SomeTrait[T] object SomeTrait: - given [T]: SomeTrait[T] with {} + given [T] => SomeTrait[T]() def f1[T](using p: Mirror.ProductOf[T]): Tuple.Elem[p.MirroredElemTypes, 0] = ??? diff --git a/tests/pos/i19857.scala b/tests/pos/i19857.scala index aeb6e49111c6..9414290fc369 100644 --- a/tests/pos/i19857.scala +++ b/tests/pos/i19857.scala @@ -18,6 +18,6 @@ type FromProduct[T <: Product] <: DFTypeAny = T match trait Width2[T] object Width2: - inline given [T]: Width2[T] = new Width2[T] {} + inline given [T] => Width2[T] = new Width2[T] {} val x = summon[Width2[Of[(DFBit, DFBit)]]] diff --git a/tests/pos/i19942.1.scala b/tests/pos/i19942.1.scala index 20f923886089..b4ae15bd2b2e 100644 --- a/tests/pos/i19942.1.scala +++ b/tests/pos/i19942.1.scala @@ -13,11 +13,11 @@ object DerivedAlternative: inline def apply[F[_]]: Alternative[F] = import DerivedAlternative.given summonInline[DerivedAlternative[F]].instance - given nested[F[_], G[_]]: DerivedAlternative[F <<< G] = ??? + given nested: [F[_], G[_]] => DerivedAlternative[F <<< G] = ??? object auto: object alternative: - transparent inline given [F[_]]: Alternative[F] = DerivedAlternative[F] + transparent inline given [F[_]] => Alternative[F] = DerivedAlternative[F] trait Test: import Test.* diff --git a/tests/pos/i19955a.scala b/tests/pos/i19955a.scala index b8ea95d41d24..4c89aa615511 100644 --- a/tests/pos/i19955a.scala +++ b/tests/pos/i19955a.scala @@ -2,7 +2,7 @@ trait Summon[R, T <: R]: type Out object Summon: - given [R, T <: R]: Summon[R, T] with + given [R, T <: R] => Summon[R, T]: type Out = R trait DFTypeAny @@ -14,7 +14,7 @@ trait Candidate[R]: type OutW <: Int object Candidate: type Aux[R, O <: Int] = Candidate[R] { type OutW = O } - given [W <: Int, R <: DFValOf[DFBits[W]]]: Candidate[R] with + given [W <: Int, R <: DFValOf[DFBits[W]]] => Candidate[R]: type OutW = W extension [L](lhs: L) def foo(using es: Summon[L, lhs.type]): Unit = ??? diff --git a/tests/pos/i19955b.scala b/tests/pos/i19955b.scala index 99e101b312b1..845b6df9d91f 100644 --- a/tests/pos/i19955b.scala +++ b/tests/pos/i19955b.scala @@ -3,11 +3,11 @@ trait Wrap[W] trait IsWrapOfInt[R]: type Out <: Int -given [W <: Int, R <: Wrap[W]]: IsWrapOfInt[R] with +given [W <: Int, R <: Wrap[W]] => IsWrapOfInt[R]: type Out = Int trait IsInt[U <: Int] -given [U <: Int]: IsInt[U] = ??? +given [U <: Int] => IsInt[U] = ??? extension [L](lhs: L) def get(using ev: IsWrapOfInt[L]): ev.Out = ??? extension (lhs: Int) def isInt(using IsInt[lhs.type]): Unit = ??? diff --git a/tests/pos/i20053b.scala b/tests/pos/i20053b.scala index 25180d56bbae..aedd4e88019c 100644 --- a/tests/pos/i20053b.scala +++ b/tests/pos/i20053b.scala @@ -1,10 +1,10 @@ trait Sub[R, T >: R] -given [R, T >: R]: Sub[R, T] with {} +given [R, T >: R] => Sub[R, T]() trait Candidate[-R]: type OutP -given [P]: Candidate[Option[P]] with +given [P] => Candidate[Option[P]]: type OutP = P extension [L](lhs: L) diff --git a/tests/pos/i20080.scala b/tests/pos/i20080.scala index dbf6843fcbc4..cd8dc15c8add 100644 --- a/tests/pos/i20080.scala +++ b/tests/pos/i20080.scala @@ -4,11 +4,11 @@ trait Zippable[-A, -B]: def zip(left: A, right: B): Out object Zippable extends ZippableLowPrio: - given append[A <: Tuple, B]: (Zippable[A, B] { type Out = Tuple.Append[A, B] }) = + given append: [A <: Tuple, B] => (Zippable[A, B] { type Out = Tuple.Append[A, B] }) = (left, right) => left :* right trait ZippableLowPrio: - given pair[A, B]: (Zippable[A, B] { type Out = (A, B) }) = + given pair: [A, B] => (Zippable[A, B] { type Out = (A, B) }) = (left, right) => (left, right) @@ -17,16 +17,16 @@ object Minimization: trait Fun1: type Out def apply(x: Any): Out - + type M[X] = X match case String => X - + def test[A] = - + val _: Fun1 { type Out = M[A] } = new Fun1: type Out = M[A] def apply(x: Any): Out = ??? - + val _: Fun1 { type Out = M[A] } = x => ??? - + val _: Fun1 { type Out = A match {case String => A} } = x => ??? diff --git a/tests/pos/i20344.scala b/tests/pos/i20344.scala index d3b2a060d6e2..0e8a3d8baabc 100644 --- a/tests/pos/i20344.scala +++ b/tests/pos/i20344.scala @@ -19,7 +19,7 @@ type Beta[R] = [F[_]] =>> GenBeta[R, R, R][F] object Beta: trait Params[+A, +B] trait BetaInstances: - given schrodingerRandomBetaForDouble[F[_]: Monad]: Beta[Double][F] = ??? + given schrodingerRandomBetaForDouble: [F[_]: Monad] => Beta[Double][F] = ??? object all extends BetaInstances diff --git a/tests/pos/i20377.scala b/tests/pos/i20377.scala index 7a4c0fccfd7e..661fa7adfca9 100644 --- a/tests/pos/i20377.scala +++ b/tests/pos/i20377.scala @@ -6,7 +6,7 @@ class ClassToMap[A]() abstract class ClassToFind[Rows <: AnyNamedTuple]: def mapped: NamedTuple.Map[Rows, ClassToMap] -given TDB: ClassToFind[(t1: Int, t2: String)] with +given TDB: ClassToFind[(t1: Int, t2: String)]: override def mapped = ( t1 = ClassToMap[Int](), t2 = ClassToMap[String]() diff --git a/tests/pos/i20572.scala b/tests/pos/i20572.scala index 4ee4490c839c..b1c1d549936e 100644 --- a/tests/pos/i20572.scala +++ b/tests/pos/i20572.scala @@ -1,7 +1,7 @@ //> using options -Werror trait Writes[T] trait Format[T] extends Writes[T] -given [T: List]: Writes[T] = null -given [T]: Format[T] = null +given [T: List] => Writes[T] = null +given [T] => Format[T] = null val _ = summon[Writes[Int]] diff --git a/tests/pos/i20858/defns_1.scala b/tests/pos/i20858/defns_1.scala index 7b4b84745b58..0479f30af22b 100644 --- a/tests/pos/i20858/defns_1.scala +++ b/tests/pos/i20858/defns_1.scala @@ -16,7 +16,7 @@ trait AutoLayer[A]: ): ZLayer[IAnyType[p.MirroredElemTypes], Nothing, A] object AutoLayer: - inline given derived[A](using p: Mirror.ProductOf[A]): AutoLayer[A] = { + inline given derived: [A] => (p: Mirror.ProductOf[A]) => AutoLayer[A] = { val a: ZIO[IAnyType[p.MirroredElemTypes], Nothing, A] = ??? new AutoLayer[A]: override def zlayer(using diff --git a/tests/pos/i21036.scala b/tests/pos/i21036.scala index 1c98346e4ef3..c80889a976eb 100644 --- a/tests/pos/i21036.scala +++ b/tests/pos/i21036.scala @@ -7,10 +7,10 @@ opaque type Id = String object Id: given SameRuntime[Id, String] = ??? -given BSONHandler[String] = ??? -given [T: BSONHandler]: BSONHandler[List[T]] = ??? +given BSONHandler[String] = ??? +given [T: BSONHandler] => BSONHandler[List[T]] = ??? -given opaqueWriter[T, A](using rs: SameRuntime[T, A], writer: BSONWriter[A]): BSONWriter[T] = ??? +given opaqueWriter: [T, A] => (rs: SameRuntime[T, A], writer: BSONWriter[A]) => BSONWriter[T] = ??? val x = summon[BSONHandler[List[Id]]] // this doesn't emit warning val y = summon[BSONWriter[List[Id]]] // this did emit warning diff --git a/tests/pos/i21303/Test.scala b/tests/pos/i21303/Test.scala index fe3efa6e38f3..be6d0df22850 100644 --- a/tests/pos/i21303/Test.scala +++ b/tests/pos/i21303/Test.scala @@ -11,11 +11,11 @@ trait TSNamedType[T] extends TSType[T] trait DefaultTSTypes extends JavaTSTypes trait JavaTSTypes { - given javaEnumTSType[E <: java.lang.Enum[E]: ClassTag]: TSType[E] = ??? + given javaEnumTSType: [E <: java.lang.Enum[E]: ClassTag] => TSType[E] = ??? } object DefaultTSTypes extends DefaultTSTypes trait TSTypeMacros { - inline given [T: Mirror.Of]: TSType[T] = derived[T] + inline given [T: Mirror.Of] => TSType[T] = derived[T] inline def derived[T](using m: Mirror.Of[T]): TSType[T] = { val elemInstances = summonAll[m.MirroredElemTypes] ??? diff --git a/tests/pos/i21303a/Test.scala b/tests/pos/i21303a/Test.scala index 83a598b5f17f..af1471fe3c12 100644 --- a/tests/pos/i21303a/Test.scala +++ b/tests/pos/i21303a/Test.scala @@ -11,12 +11,12 @@ trait TSNamedType[T] extends TSType[T] trait DefaultTSTypes extends JavaTSTypes trait JavaTSTypes { - given javaEnumTSType[E <: java.lang.Enum[E]: ClassTag]: TSType[E] = ??? - given javaEnumTSNamedType[E <: java.lang.Enum[E]: ClassTag]: TSNamedType[E] = ??? + given javaEnumTSType: [E <: java.lang.Enum[E]: ClassTag] => TSType[E] = ??? + given javaEnumTSNamedType: [E <: java.lang.Enum[E]: ClassTag] => TSNamedType[E] = ??? } object DefaultTSTypes extends DefaultTSTypes trait TSTypeMacros { - inline given [T: Mirror.Of]: TSType[T] = derived[T] + inline given [T: Mirror.Of] => TSType[T] = derived[T] inline def derived[T](using m: Mirror.Of[T]): TSType[T] = { val elemInstances = summonAll[m.MirroredElemTypes] ??? diff --git a/tests/pos/i21320a.scala b/tests/pos/i21320a.scala index 0a7e0d1941d1..03930f0b90c9 100644 --- a/tests/pos/i21320a.scala +++ b/tests/pos/i21320a.scala @@ -6,7 +6,7 @@ trait ConfigMonoid[T]: def orElse(main: T, defaults: T): T object ConfigMonoid: - given option[T]: ConfigMonoid[Option[T]] = ??? + given option: [T] => ConfigMonoid[Option[T]] = ??? inline def zeroTuple[C <: Tuple]: Tuple = inline erasedValue[C] match @@ -25,7 +25,7 @@ object ConfigMonoid: defaults ) - inline given derive[T](using m: Mirror.ProductOf[T]): ConfigMonoid[T] = + inline given derive: [T] => (m: Mirror.ProductOf[T]) => ConfigMonoid[T] = new ConfigMonoid[T]: def zero: T = m.fromProduct(zeroTuple[m.MirroredElemTypes]) def orElse(main: T, defaults: T): T = m.fromProduct(valueTuple[m.MirroredElemTypes, T](0, main, defaults)) diff --git a/tests/pos/i21320b.scala b/tests/pos/i21320b.scala index 6711d3d9d952..2c4963ec2f03 100644 --- a/tests/pos/i21320b.scala +++ b/tests/pos/i21320b.scala @@ -6,7 +6,7 @@ trait ConfigMonoid[T]: def orElse(main: T, defaults: T): T object ConfigMonoid: - given option[T]: ConfigMonoid[Option[T]] = ??? + given option: [T] => ConfigMonoid[Option[T]] = ??? inline def zeroTuple[C <: Tuple]: Tuple = inline erasedValue[C] match @@ -25,7 +25,7 @@ object ConfigMonoid: defaults ) - inline given derive[T](using m: Mirror.ProductOf[T]): ConfigMonoid[T] = + inline given derive: [T] => (m: Mirror.ProductOf[T]) => ConfigMonoid[T] = new ConfigMonoid[T]: def zero: T = m.fromProduct(zeroTuple[m.MirroredElemTypes]) def orElse(main: T, defaults: T): T = m.fromProduct(valueTuple[m.MirroredElemTypes, T](0, main, defaults)) diff --git a/tests/pos/i21352a/schema.scala b/tests/pos/i21352a/schema.scala index 486e1bb1ea34..c8b5dd3c2398 100644 --- a/tests/pos/i21352a/schema.scala +++ b/tests/pos/i21352a/schema.scala @@ -11,7 +11,7 @@ object Schema extends SchemaCompanionMacros: ??? trait SchemaCompanionMacros extends SchemaDerivation: - given derivedStringBasedUnionEnumeration[S](using IsUnionOf[String, S]): Schema[S] = + given derivedStringBasedUnionEnumeration: [S] => IsUnionOf[String, S] => Schema[S] = val x: Schema[S] = ??? x.name(None) diff --git a/tests/pos/i21352a/schemaDerivation.scala b/tests/pos/i21352a/schemaDerivation.scala index d34a59c51a61..9a64167ac98d 100644 --- a/tests/pos/i21352a/schemaDerivation.scala +++ b/tests/pos/i21352a/schemaDerivation.scala @@ -15,7 +15,7 @@ object CaseClass: sealed trait IsUnionOf[T, A] object IsUnionOf: - transparent inline given derived[T, A]: IsUnionOf[T, A] = ${ deriveImpl[T, A] } + transparent inline given derived: [T, A] => IsUnionOf[T, A] = ${ deriveImpl[T, A] } private def deriveImpl[T, A](using quotes: Quotes): Expr[IsUnionOf[T, A]] = ??? trait SchemaDerivation: diff --git a/tests/pos/i21352b.scala b/tests/pos/i21352b.scala index 6e1dfbd18e3c..ddf268000969 100644 --- a/tests/pos/i21352b.scala +++ b/tests/pos/i21352b.scala @@ -6,7 +6,7 @@ object serializer: implicit val UnitReader: Reader[Unit] = ??? implicit val StringReader: Reader[String] = ??? // A way to derive instances needs to be available - inline given superTypeReader[T: scala.reflect.ClassTag]: Reader[T] = ??? + inline given superTypeReader: [T: scala.reflect.ClassTag] => Reader[T] = ??? import serializer.Reader trait Codec[T] @@ -25,7 +25,7 @@ trait Communicate[F[_]]: def notification[X <: LSPNotification](notif: X, in: notif.In): F[Unit] object Communicate: - given codec[T: Reader]: Codec[T] = ??? + given codec: [T: Reader] => Codec[T] = ??? def channel[F[_]: Monadic](channel: Channel[F]) = new Communicate[F]: diff --git a/tests/pos/i21352c.scala b/tests/pos/i21352c.scala index 22169f3560a8..a06fd64b1fd8 100644 --- a/tests/pos/i21352c.scala +++ b/tests/pos/i21352c.scala @@ -7,7 +7,7 @@ trait ReadImplicits: import scala.deriving.* given roe: Read[Option[EmptyTuple]] = ??? given rou: Read[Option[Unit]] = ??? - given cons1[H, T <: Tuple](using Read[Option[H]], Read[Option[T]]): Read[Option[H *: T]] = ??? + given cons1: [H, T <: Tuple] => (Read[Option[H]], Read[Option[T]]) => Read[Option[H *: T]] = ??? trait Fragment: def query[B: Read]: String = ??? diff --git a/tests/pos/i21390.zio.scala b/tests/pos/i21390.zio.scala index 3aece69632b3..c04d99b64b27 100644 --- a/tests/pos/i21390.zio.scala +++ b/tests/pos/i21390.zio.scala @@ -5,7 +5,7 @@ class Has[A] object Has: class Union[B, C] object Union: - given HasHasUnion[B0 <: Has[?], C0 <: Has[?]]: Union[B0, C0] = ??? + given HasHasUnion: [B0 <: Has[?], C0 <: Has[?]] => Union[B0, C0] = ??? class Lay[+D]: def and1[B1 >: D, C1](that: Lay[C1])(using Has.Union[B1, C1]): Lay[B1 & C1] = ??? diff --git a/tests/pos/i5915.scala b/tests/pos/i5915.scala index acccbf64a684..c6df5eaebe53 100644 --- a/tests/pos/i5915.scala +++ b/tests/pos/i5915.scala @@ -2,8 +2,8 @@ trait RunDSL val rdsl = new RunDSL {} -given RunNNFExpr[B]: RunDSL = rdsl +given RunNNFExpr: [B] => RunDSL = rdsl -given RunNNFImpl[B]: RunDSL with { +given RunNNFImpl: [B] => RunDSL { //override def runDSL(b: NNF[B]): B = b.terminal } \ No newline at end of file diff --git a/tests/pos/i5978.scala b/tests/pos/i5978.scala index f1954b8c8275..d254d78e93aa 100644 --- a/tests/pos/i5978.scala +++ b/tests/pos/i5978.scala @@ -8,7 +8,7 @@ trait TokenParser[Token, R] package p1 { object TextParser { - given TP: TokenParser[Char, Position[CharSequence]] with {} + given TP: TokenParser[Char, Position[CharSequence]]() def f (using TokenParser[Char, Position[CharSequence]]) = ??? @@ -85,9 +85,9 @@ package p3 { package p4 { class TC - given A: TC with {} + given A: TC() - given B[X[_], Y]: TC with {} + given B: [X[_], Y] => TC() - given C(using TC): TC with {} + given C: TC => TC() } \ No newline at end of file diff --git a/tests/pos/i6716.scala b/tests/pos/i6716.scala index 617adc3c09f0..721a9eb9a794 100644 --- a/tests/pos/i6716.scala +++ b/tests/pos/i6716.scala @@ -2,7 +2,7 @@ trait Monad[T]: def id: String class Foo object Foo { - given Monad[Foo] with { def id = "Foo" } + given Monad[Foo] { def id = "Foo" } } opaque type Bar = Foo diff --git a/tests/pos/i6900.scala b/tests/pos/i6900.scala index 55587a18b4ba..1aa04b1ee177 100644 --- a/tests/pos/i6900.scala +++ b/tests/pos/i6900.scala @@ -8,7 +8,7 @@ object Test1 { // But not with newstyle /* - given [A]: Conversion[A, Foo[A]] with + given [A]: Conversion[A, Foo[A]]: def apply(a: A) = new Foo[A]: def foo[C]: C => A = _ => a */ diff --git a/tests/pos/i6914.scala b/tests/pos/i6914.scala index 2d8cf164f422..c4d840f7bbdc 100644 --- a/tests/pos/i6914.scala +++ b/tests/pos/i6914.scala @@ -5,7 +5,7 @@ object test1 { class ToExpr[T](using Liftable[T]) extends Conversion[T, Expr[T]] { def apply(x: T): Expr[T] = ??? } - given toExpr[T](using Liftable[T]): ToExpr[T] with {} + given toExpr: [T] => Liftable[T] => ToExpr[T]() given Liftable[Int] = ??? given Liftable[String] = ??? @@ -18,7 +18,7 @@ object test1 { object test2 { - given autoToExpr[T](using Liftable[T]): Conversion[T, Expr[T]] with { + given autoToExpr: [T] => Liftable[T] => Conversion[T, Expr[T]] { def apply(x: T): Expr[T] = ??? } diff --git a/tests/pos/i6938.scala b/tests/pos/i6938.scala index e58ab2829cf9..8127fc133f72 100644 --- a/tests/pos/i6938.scala +++ b/tests/pos/i6938.scala @@ -1,5 +1,5 @@ trait Foo[T] object Foo: - given [T]: Foo[Tuple1[T]] with {} - given [T, U]: Foo[(T, U)] with {} - given [T, U, V]: Foo[(T, U, V)] with {} \ No newline at end of file + given [T] => Foo[Tuple1[T]]() + given [T, U] => Foo[(T, U)]() + given [T, U, V] => Foo[(T, U, V)]() \ No newline at end of file diff --git a/tests/pos/i7056.scala b/tests/pos/i7056.scala index a347dfe7b519..fa3c132b58b3 100644 --- a/tests/pos/i7056.scala +++ b/tests/pos/i7056.scala @@ -9,7 +9,7 @@ trait T1[T] { extension (t1: T) def idnt1: Any } -given [T <: A](using PartialId[T]): T1[T] = new T1[T] { +given [T <: A] => PartialId[T] => T1[T] = new T1[T] { extension (t1: T) def idnt1: Any = ??? } diff --git a/tests/pos/i7375.scala b/tests/pos/i7375.scala index 9da548f99ce7..0320696b0c5d 100644 --- a/tests/pos/i7375.scala +++ b/tests/pos/i7375.scala @@ -5,7 +5,7 @@ trait Entity[M, T, P]: class GreetingPerson(private val name: String) object GreetingPerson: - given GreetingPersonEntity: Entity[GreetingPerson, GreetedPerson, String] with + given GreetingPersonEntity: Entity[GreetingPerson, GreetedPerson, String]: extension (me: GreetingPerson) def receive(sender: GreetedPerson)(msg: String)(using Entity[GreetedPerson, GreetingPerson, String]): Unit = println(f"Thanks for saying $msg, ${sender.name()}") @@ -15,7 +15,7 @@ object GreetingPerson: class GreetedPerson(private val name: String) object GreetedPerson: - given GreetedPersonEntity: Entity[GreetedPerson, GreetingPerson, String] with + given GreetedPersonEntity: Entity[GreetedPerson, GreetingPerson, String]: extension (me: GreetedPerson) def receive(sender: GreetingPerson)(msg: String)(using Entity[GreetingPerson, GreetedPerson, String]): Unit = println(f"Thanks for saying $msg, ${sender.name()}") diff --git a/tests/pos/i7413.scala b/tests/pos/i7413.scala index ebc0c5b2777a..2aaf87a1e82a 100644 --- a/tests/pos/i7413.scala +++ b/tests/pos/i7413.scala @@ -11,7 +11,7 @@ trait Greeter: case class MyFixture(name: String, greeter: Greeter) object Test1: - given conv: Conversion[0, Greeter] with + given conv: Conversion[0, Greeter]: def apply(x: 0): Greeter = ??? val g: Greeter = 0 diff --git a/tests/pos/i7586.scala b/tests/pos/i7586.scala index 364c99478337..b0ecd84e5aff 100644 --- a/tests/pos/i7586.scala +++ b/tests/pos/i7586.scala @@ -5,14 +5,15 @@ case class S[N <: Nat](pred: N) extends Nat type Z = Z.type given zero: Z = Z -given succ[N <: Nat](using n: N): S[N] = S(n) +given succ: [N <: Nat] => (n: N) => S[N] = S(n) case class Sum[N <: Nat, M <: Nat, R <: Nat](result: R) -given sumZ[N <: Nat](using n: N): Sum[Z, N, N] = Sum(n) -given sumS[N <: Nat, M <: Nat, R <: Nat]( - using sum: Sum[N, M, R] -): Sum[S[N], M, S[R]] = Sum(S(sum.result)) +given sumZ: [N <: Nat] => (n: N) => Sum[Z, N, N] = Sum(n) +given sumS: [N <: Nat, M <: Nat, R <: Nat] + => (sum: Sum[N, M, R]) + => Sum[S[N], M, S[R]] + = Sum(S(sum.result)) def add[N <: Nat, M <: Nat, R <: Nat](n: N, m: M)( using sum: Sum[N, M, R] diff --git a/tests/pos/i7851.scala b/tests/pos/i7851.scala index 16d28ad353f9..612a6abeb873 100644 --- a/tests/pos/i7851.scala +++ b/tests/pos/i7851.scala @@ -1,18 +1,18 @@ //> using options -experimental trait Wrappable[T] { } -given Wrappable[Float] with { } +given Wrappable[Float]() case class Wrapped[T: Wrappable](value: T) trait Wrapper[T] { type WrappedT } object Wrapper { type Aux[T <: Tuple, WrappedT0 <: Tuple] = Wrapper[T] { type WrappedT = WrappedT0 } } -given Wrapper[EmptyTuple] with { type WrappedT = EmptyTuple } +given Wrapper[EmptyTuple] { type WrappedT = EmptyTuple } -given [T: Wrappable]: Wrapper[T] with { type WrappedT = Wrapped[T] } +given [T: Wrappable] => Wrapper[T] { type WrappedT = Wrapped[T] } -given [H: Wrappable, T <: Tuple, WrappedT0 <: Tuple](using Wrapper.Aux[T, WrappedT0]): Wrapper[H *: T] with { +given [H: Wrappable, T <: Tuple, WrappedT0 <: Tuple] => Wrapper.Aux[T, WrappedT0] => Wrapper[H *: T] { type WrappedT = Wrapped[H] *: WrappedT0 } diff --git a/tests/pos/i7868.scala b/tests/pos/i7868.scala index f4d7da6acb5b..fa31bd131b0c 100644 --- a/tests/pos/i7868.scala +++ b/tests/pos/i7868.scala @@ -15,16 +15,15 @@ object Coproduct { object At { - given atHead[Head, Tail]: At[Head +: Tail, Head, 0] with { + given atHead: [Head, Tail] => At[Head +: Tail, Head, 0]: def cast: Head <:< Head +: Tail = summon[Head <:< Head +: Tail] - } given atTail[Head, Tail, Value, NextIndex <: Int] (using atNext: At[Tail, Value, NextIndex]) : At[Head +: Tail, Value, S[NextIndex]] with val cast: Value <:< Head +: Tail = atNext.cast - given [A](using A): (() => A) = { () => summon[A]} + given [A] => A => (() => A) = { () => summon[A] } } def upCast[A, B](a: A)(using erased evidence: (A <:< B) ): B = a.asInstanceOf[B] diff --git a/tests/pos/i7878.scala b/tests/pos/i7878.scala index 05a1b6093e6a..68815c35eb96 100644 --- a/tests/pos/i7878.scala +++ b/tests/pos/i7878.scala @@ -4,7 +4,7 @@ object Boom { import scala.compiletime.* trait Fail[A <: Int, B <: Int] - transparent inline given fail[X <: Int, Y <: Int]: Fail[X, Y] = { + transparent inline given fail: [X <: Int, Y <: Int] => Fail[X, Y] = { scala.compiletime.summonFrom { case t: Fail[X, y] if constValue[y] < constValue[Y] => ??? } diff --git a/tests/pos/i8182.scala b/tests/pos/i8182.scala index 9acf2941c570..08b40cb570ab 100644 --- a/tests/pos/i8182.scala +++ b/tests/pos/i8182.scala @@ -3,8 +3,8 @@ package example trait Show[-A]: extension (a: A) def show: String -given (using rec: Show[String]): Show[String] = ??? // must be Show[String] as the argument +given Show[String] => Show[String] = ??? // must be Show[String] as the argument -given (using rec: => Show[String]): Show[Option[String]] = ??? // must be byname argument +given (rec: => Show[String]) => Show[Option[String]] = ??? // must be byname argument def test = Option("").show diff --git a/tests/pos/i8198.scala b/tests/pos/i8198.scala index 5e4efa82924a..7ea8f67d25de 100644 --- a/tests/pos/i8198.scala +++ b/tests/pos/i8198.scala @@ -6,6 +6,6 @@ trait Eq[A] { case class Id[T](id: T) -given idEq[A](using eqA: Eq[A]): Eq[Id[A]] = new { +given idEq: [A] => (eqA: Eq[A]) => Eq[Id[A]] = new { extension (i1: Id[A]) def === (i2: Id[A]) = !(i1.id /== i2.id) } diff --git a/tests/pos/i8276.scala b/tests/pos/i8276.scala index e68cf009bc33..3e2ad15bd8f4 100644 --- a/tests/pos/i8276.scala +++ b/tests/pos/i8276.scala @@ -1,6 +1,6 @@ object NOTHING -inline given [A]: Conversion[NOTHING.type, Option[A]] = _ => None +inline given [A] => Conversion[NOTHING.type, Option[A]] = _ => None def apply[A](p: Vector[A], o: Option[A] = NOTHING): Unit = ??? diff --git a/tests/pos/i8344-1.scala b/tests/pos/i8344-1.scala index 92b393da2497..2707507f39f5 100644 --- a/tests/pos/i8344-1.scala +++ b/tests/pos/i8344-1.scala @@ -5,7 +5,7 @@ enum Datatype[T] { } object Datatype { - given [H, T <: STuple](using ht: Datatype[H], tt: Datatype[T]): Datatype[H *: T] = tt match { + given [H, T <: STuple] => (ht: Datatype[H], tt: Datatype[T]) => Datatype[H *: T] = tt match { case Datatype.Tuple(elems) => Datatype.Tuple(ht *: elems) } } diff --git a/tests/pos/i8397.scala b/tests/pos/i8397.scala index d0b97f84129d..707d8c1f1942 100644 --- a/tests/pos/i8397.scala +++ b/tests/pos/i8397.scala @@ -1,4 +1,4 @@ -given foo(using x: Int): AnyRef with +given foo: (x: Int) => AnyRef: type T = x.type // #7859 @@ -6,17 +6,17 @@ given foo(using x: Int): AnyRef with trait Lub2[A, B]: type Output -given [A <: C, B <: C, C]: Lub2[A, B] with +given [A <: C, B <: C, C] => Lub2[A, B]: type Output = C trait Lub[Union]: type Output -given [A]: Lub[A] with +given [A] => Lub[A]: type Output = A -given [Left, Right]( - using lubLeft: Lub[Right], lubRight: Lub[Right])( - using lub2: Lub2[lubLeft.Output, lubRight.Output]) - : Lub[Left | Right] with +given [Left, Right] + => (lubLeft: Lub[Right], lubRight: Lub[Right]) + => (lub2: Lub2[lubLeft.Output, lubRight.Output]) + => Lub[Left | Right]: type Output = lub2.Output diff --git a/tests/pos/i8623.scala b/tests/pos/i8623.scala index e0df48811e1c..69664bfd5148 100644 --- a/tests/pos/i8623.scala +++ b/tests/pos/i8623.scala @@ -11,7 +11,7 @@ def test1 = unseal.pos def test2 = - given QC with {} + given QC() def unseal(using qctx: QC): qctx.tasty.Tree = ??? unseal.pos diff --git a/tests/pos/i8825.scala b/tests/pos/i8825.scala index d7115babfdc4..a9c487b5404a 100644 --- a/tests/pos/i8825.scala +++ b/tests/pos/i8825.scala @@ -17,7 +17,7 @@ object Length { def instance[L <: HList, Out0 <: Nat]: Aux[L, Out0] = new Length[L] { type Out = Out0 } given hnilLength: Aux[HNil, Zero] = instance - given hconsLength[H, T <: HList] (using length: Length[T]): Aux[HCons[H, T], Succ[length.Out]] = instance // (*) + given hconsLength: [H, T <: HList] => (length: Length[T]) => Aux[HCons[H, T], Succ[length.Out]] = instance // (*) //given hconsLength[H, T <: HList, N <: Nat] (using length: Aux[T, N]): Aux[HCons[H, T], Succ[N]] = instance // (**) } diff --git a/tests/pos/i8927.scala b/tests/pos/i8927.scala index 2dfb419abab3..ab1e850ff8e6 100644 --- a/tests/pos/i8927.scala +++ b/tests/pos/i8927.scala @@ -17,7 +17,7 @@ sealed trait DPair[k <: AnyKind, K[_ <: k], +V[_ <: k]]: case _ => None object DPair: - given pair [k, K[_ <: k], V[_ <: k], C <: k]: Conversion[(K[C], V[C]), DPair[k, K, V]] = tup => + given pair: [k, K[_ <: k], V[_ <: k], C <: k] => Conversion[(K[C], V[C]), DPair[k, K, V]] = tup => case class dpair(key: K[C], value: V[C]) extends DPair[k, K, V]: type A = C dpair(tup._1, tup._2) diff --git a/tests/pos/i9342b.scala b/tests/pos/i9342b.scala index e317391f9bb8..36093876e989 100644 --- a/tests/pos/i9342b.scala +++ b/tests/pos/i9342b.scala @@ -1,7 +1,7 @@ trait Label[A]: def apply(v: A): String -given [A]: Label[A] = _.toString +given [A] => Label[A] = _.toString extension [A](x: A) inline def label(using inline l: Label[A]): String = l(x) diff --git a/tests/pos/i9530.scala b/tests/pos/i9530.scala index 32b2f26dbd6c..ab481bd64d1b 100644 --- a/tests/pos/i9530.scala +++ b/tests/pos/i9530.scala @@ -15,12 +15,12 @@ extension [A <: Animal](animal: A)(using diet: Diet[A]) def food4 = diet.food trait Monkey extends Animal -given Diet[Monkey] with +given Diet[Monkey]: type F = Banana def food: Seq[Banana] = Seq(new Banana("yellow"), Banana("green")) trait FoodOps -given FoodOps with +given FoodOps: extension [A <: Animal](using diet: Diet[A])(animal: A) def food5 = diet.food extension [A <: Animal](animal: A)(using diet: Diet[A]) def food6 = diet.food diff --git a/tests/pos/implicit-conversion.scala b/tests/pos/implicit-conversion.scala index a2d12b8ab709..9154b24681c9 100644 --- a/tests/pos/implicit-conversion.scala +++ b/tests/pos/implicit-conversion.scala @@ -1,6 +1,6 @@ object Test { // a problematic implicit conversion, should we flag it? - given Conversion[String, Int] with { + given Conversion[String, Int] { def apply(x: String): Int = Integer.parseInt(toString) } } \ No newline at end of file diff --git a/tests/pos/implicit-prefix-disambiguation.scala b/tests/pos/implicit-prefix-disambiguation.scala index f7843e7f5831..cd1906fe5043 100644 --- a/tests/pos/implicit-prefix-disambiguation.scala +++ b/tests/pos/implicit-prefix-disambiguation.scala @@ -4,7 +4,7 @@ class J[X] trait A: given I[B] = ??? - given (using I[B]): J[B] = ??? + given I[B] => J[B] = ??? object A extends A trait B extends A diff --git a/tests/pos/interleaving-functor.scala b/tests/pos/interleaving-functor.scala index b588e35f60a2..e4a3804ef928 100644 --- a/tests/pos/interleaving-functor.scala +++ b/tests/pos/interleaving-functor.scala @@ -7,7 +7,7 @@ object functorInterleaving: def map[A](x: F[A])[B](f: A => B): F[B] - given Functor[List] with + given Functor[List]: def map[A](x: List[A])[B](f: A => B): List[B] = x.map(f) diff --git a/tests/pos/mt-deskolemize.scala b/tests/pos/mt-deskolemize.scala index 34f38289b24d..df408e67d767 100644 --- a/tests/pos/mt-deskolemize.scala +++ b/tests/pos/mt-deskolemize.scala @@ -37,7 +37,7 @@ class MyExpr3 extends ProdExprAlt[(Prim, VecExpr[Prim], Prim)] trait Constable[E <: Expr]: def lit(v: ExtractValue[E]): E object Constable: - given [E <: Expr]: Constable[E] = ??? + given [E <: Expr] => Constable[E] = ??? object Test: def fromLiteral[E <: Expr : Constable](v: ExtractValue[E]): E = diff --git a/tests/pos/multi-given.scala b/tests/pos/multi-given.scala index 5553df36f1c9..2b404672e9cb 100644 --- a/tests/pos/multi-given.scala +++ b/tests/pos/multi-given.scala @@ -8,3 +8,5 @@ def foo(implicit a: A, b: B, c: C) = "foo" given A() with B given ops: A() with B() + +given ops2: A(), B diff --git a/tests/pos/multiversal.scala b/tests/pos/multiversal.scala index f7fa14264a3c..d6fd267555f5 100644 --- a/tests/pos/multiversal.scala +++ b/tests/pos/multiversal.scala @@ -1,7 +1,7 @@ object Test { import scala.CanEqual - given [X, Y](using CanEqual[X, Y]): CanEqual[List[X], List[Y]] = CanEqual.derived + given [X, Y] => CanEqual[X, Y] => CanEqual[List[X], List[Y]] = CanEqual.derived val b: Byte = 1 val c: Char = 2 diff --git a/tests/pos/not-looping-implicit.scala b/tests/pos/not-looping-implicit.scala index ebaf25e760f2..d99da915fbf4 100644 --- a/tests/pos/not-looping-implicit.scala +++ b/tests/pos/not-looping-implicit.scala @@ -30,7 +30,7 @@ object Schema { ??? } - inline given gen[A]: Schema[A] = derived[A] + inline given gen: [A] => Schema[A] = derived[A] } sealed trait InputValue diff --git a/tests/pos/ord-over-tracked.scala b/tests/pos/ord-over-tracked.scala index a9b4aba556e1..4016a575a838 100644 --- a/tests/pos/ord-over-tracked.scala +++ b/tests/pos/ord-over-tracked.scala @@ -6,7 +6,7 @@ trait Ord[T]: given Ord[Int] = ??? case class D(tracked val x: Int) -given [T <: D]: Ord[T] = (a, b) => a.x < b.x +given [T <: D] => Ord[T] = (a, b) => a.x < b.x def mySort[T: Ord](x: Array[T]): Array[T] = ??? diff --git a/tests/pos/parsercombinators-ctx-bounds.scala b/tests/pos/parsercombinators-ctx-bounds.scala index d77abea5e539..50338dbc2fa5 100644 --- a/tests/pos/parsercombinators-ctx-bounds.scala +++ b/tests/pos/parsercombinators-ctx-bounds.scala @@ -17,7 +17,7 @@ end Combinator final case class Apply[C, E](action: C => Option[E]) final case class Combine[A, B](first: A, second: B) -given apply[C, E]: Combinator[Apply[C, E]] with { +given apply: [C, E] => Combinator[Apply[C, E]] { type Context = C type Element = E extension(self: Apply[C, E]) { diff --git a/tests/pos/parsercombinators-givens-2.scala b/tests/pos/parsercombinators-givens-2.scala index 8349d69a30af..4b00c3801716 100644 --- a/tests/pos/parsercombinators-givens-2.scala +++ b/tests/pos/parsercombinators-givens-2.scala @@ -18,7 +18,7 @@ end Combinator final case class Apply[C, E](action: C => Option[E]) final case class Combine[A, B](first: A, second: B) -given apply[C, E]: Combinator[Apply[C, E]] with { +given apply: [C, E] => Combinator[Apply[C, E]] { type Context = C type Element = E extension(self: Apply[C, E]) { diff --git a/tests/pos/parsercombinators-givens.scala b/tests/pos/parsercombinators-givens.scala index 5b5588c93840..1fa8080b0688 100644 --- a/tests/pos/parsercombinators-givens.scala +++ b/tests/pos/parsercombinators-givens.scala @@ -18,7 +18,7 @@ end Combinator final case class Apply[C, E](action: C => Option[E]) final case class Combine[A, B](first: A, second: B) -given apply[C, E]: Combinator[Apply[C, E]] with { +given apply: [C, E] => Combinator[Apply[C, E]] { type Context = C type Element = E extension(self: Apply[C, E]) { diff --git a/tests/pos/parsercombinators-this.scala b/tests/pos/parsercombinators-this.scala index 70b423985400..19ac878c888f 100644 --- a/tests/pos/parsercombinators-this.scala +++ b/tests/pos/parsercombinators-this.scala @@ -19,7 +19,7 @@ end Combinator final case class Apply[C, E](action: C => Option[E]) final case class Combine[A, B](first: A, second: B) -given apply[C, E]: Combinator with { +given apply: [C, E] => Combinator { type Self = Apply[C, E] type Context = C type Element = E diff --git a/tests/pos/phantom-Eq.scala b/tests/pos/phantom-Eq.scala index 9f892d353b41..d844c4b110c6 100644 --- a/tests/pos/phantom-Eq.scala +++ b/tests/pos/phantom-Eq.scala @@ -29,5 +29,5 @@ object EqUtil { erased given eqByteNum: PhantomEq[Byte, Number] = compiletime.erasedValue erased given eqNumByte: PhantomEq[Number, Byte] = compiletime.erasedValue - erased given eqSeq[T, U](using erased PhantomEq[T, U]): PhantomEq[Seq[T], Seq[U]] = compiletime.erasedValue + erased given eqSeq: [T, U] => (erased PhantomEq[T, U]) => PhantomEq[Seq[T], Seq[U]] = compiletime.erasedValue } diff --git a/tests/pos/phantom-Eq2/Phantom-Eq_1.scala b/tests/pos/phantom-Eq2/Phantom-Eq_1.scala index 120c68174898..b041a4a87efe 100644 --- a/tests/pos/phantom-Eq2/Phantom-Eq_1.scala +++ b/tests/pos/phantom-Eq2/Phantom-Eq_1.scala @@ -14,6 +14,6 @@ object EqUtil { erased given eqDouble: PhantomEqEq[Double] = new PhantomEq[Double, Double] erased given eqByteNum: PhantomEq[Byte, Number] = new PhantomEq[Byte, Number] erased given eqNumByte: PhantomEq[Number, Byte] = new PhantomEq[Number, Byte] - erased given eqSeq[T, U] (using erased eq: PhantomEq[T, U]): PhantomEq[Seq[T], Seq[U]] = + erased given eqSeq: [T, U] => (erased eq: PhantomEq[T, U]) => PhantomEq[Seq[T], Seq[U]] = new PhantomEq[Seq[T], Seq[U]] } diff --git a/tests/pos/phantom-Evidence.scala b/tests/pos/phantom-Evidence.scala index ecdd84cbc481..f56ce3b798ee 100644 --- a/tests/pos/phantom-Evidence.scala +++ b/tests/pos/phantom-Evidence.scala @@ -26,5 +26,5 @@ object WithNormalState { object Utils { type =::=[From, To] - erased given tpEquals[A]: (A =::= A) = compiletime.erasedValue + erased given tpEquals: [A] => (A =::= A) = compiletime.erasedValue } diff --git a/tests/pos/reference/delegates.scala b/tests/pos/reference/delegates.scala index 1cc7a29eee7d..95b9856b687b 100644 --- a/tests/pos/reference/delegates.scala +++ b/tests/pos/reference/delegates.scala @@ -26,11 +26,11 @@ end Common object Instances extends Common: - given intOrd: Ord[Int] with + given intOrd: Ord[Int]: extension (x: Int) def compareTo(y: Int) = if (x < y) -1 else if (x > y) +1 else 0 - given listOrd[T](using Ord[T]): Ord[List[T]] with + given listOrd: [T] => Ord[T] => Ord[List[T]]: extension (xs: List[T]) def compareTo(ys: List[T]): Int = (xs, ys) match case (Nil, Nil) => 0 case (Nil, _) => -1 @@ -49,13 +49,13 @@ object Instances extends Common: def second = xs.tail.head def third = xs.tail.tail.head - given listMonad: Monad[List] with + given listMonad: Monad[List]: extension [A](xs: List[A]) def flatMap[B](f: A => List[B]): List[B] = xs.flatMap(f) def pure[A](x: A): List[A] = List(x) - given readerMonad[Ctx]: Monad[[X] =>> Ctx => X] with + given readerMonad: [Ctx] => Monad[[X] =>> Ctx => X]: extension [A](r: Ctx => A) def flatMap[B](f: A => Ctx => B): Ctx => B = ctx => f(r(ctx))(ctx) def pure[A](x: A): Ctx => A = @@ -93,7 +93,7 @@ object Instances extends Common: object TastyImpl extends TastyAPI: type Symbol = String - given symDeco: SymDeco with + given symDeco: SymDeco: extension (sym: Symbol) def name = sym class D[T] @@ -122,7 +122,7 @@ object Instances extends Common: class Token(str: String) object Token: - given StringToToken: Conversion[String, Token] with + given StringToToken: Conversion[String, Token]: def apply(str: String): Token = new Token(str) val x: Token = "if" @@ -140,11 +140,11 @@ object PostConditions: end PostConditions object AnonymousInstances extends Common: - given Ord[Int] with + given Ord[Int]: extension (x: Int) def compareTo(y: Int) = if (x < y) -1 else if (x > y) +1 else 0 - given [T: Ord]: Ord[List[T]] with + given [T: Ord] => Ord[List[T]]: extension (xs: List[T]) def compareTo(ys: List[T]): Int = (xs, ys).match case (Nil, Nil) => 0 case (Nil, _) => -1 @@ -165,7 +165,7 @@ object AnonymousInstances extends Common: : Convertible[List[From], List[To]] with extension (x: List[From]) def convert: List[To] = x.map(c.convert) - given Monoid[String] with + given Monoid[String]: extension (x: String) def combine(y: String): String = x.concat(y) def unit: String = "" diff --git a/tests/pos/reference/extension-methods.scala b/tests/pos/reference/extension-methods.scala index 64fd23322c1b..54310d6f6dd9 100644 --- a/tests/pos/reference/extension-methods.scala +++ b/tests/pos/reference/extension-methods.scala @@ -81,7 +81,7 @@ object ExtMethods: trait Ord[T]: extension (x: T) def less (y: T): Boolean object Ord: - given Ord[Int] with + given Ord[Int]: extension (x: Int) def less (y: Int): Boolean = x < y end Ord @@ -90,7 +90,7 @@ object ExtMethods: extension [T](xs: Lst[Lst[T]]) def flatten: Lst[T] = xs.foldLeft(Lst())(_ ++ _) - given ord[T: Ord]: Ord[Lst[T]] with + given ord: [T: Ord] => Ord[Lst[T]]: extension (xs: Lst[T]) def less (ys: Lst[T]): Boolean = ??? end Lst diff --git a/tests/pos/suspend-strawman/choices.scala b/tests/pos/suspend-strawman/choices.scala index 968c223d9c0b..e15626c6ecc7 100644 --- a/tests/pos/suspend-strawman/choices.scala +++ b/tests/pos/suspend-strawman/choices.scala @@ -7,7 +7,7 @@ trait Choice: // the handler def choices[T](body: Choice ?=> T): Seq[T] = boundary[Seq[T]]: - given Choice with + given Choice: def choose[A](choices: A*): A = suspend[A, Seq[T]](s => choices.flatMap(s.resume)) Seq(body) diff --git a/tests/pos/suspend-strawman/generators.scala b/tests/pos/suspend-strawman/generators.scala index a890196e6215..a5c73fe41ffe 100644 --- a/tests/pos/suspend-strawman/generators.scala +++ b/tests/pos/suspend-strawman/generators.scala @@ -15,7 +15,7 @@ object generate: var step: () => Unit = () => boundary[Unit]: - given CanProduce[T] with + given CanProduce[T]: def produce(x: T): Unit = nextElem = Some(x) suspend[Unit, Unit]: k => @@ -55,7 +55,7 @@ object Variant2: var step: () => Option[T] = () => boundary: - given CanProduce[T] with + given CanProduce[T]: def produce(x: T): Unit = suspend[Unit, Option[T]]: k => step = () => k.resume(()) diff --git a/tests/pos/suspend-strawman/monadic-reflect.scala b/tests/pos/suspend-strawman/monadic-reflect.scala index 84c5255c2a96..19bb3a283c8a 100644 --- a/tests/pos/suspend-strawman/monadic-reflect.scala +++ b/tests/pos/suspend-strawman/monadic-reflect.scala @@ -48,7 +48,7 @@ trait Monadic[M[_]: Monad]: */ def reify[R](prog: CanReflect[M] ?=> R): M[R] = boundary [M[R]]: - given CanReflect[M] with + given CanReflect[M]: def reflect[R2](mr: M[R2]): R2 = suspend [R2, M[R]] (k => mr.flatMap(k.resume)) pure(prog) diff --git a/tests/pos/suspend-strawman/simple-futures.scala b/tests/pos/suspend-strawman/simple-futures.scala index 0a80a74d49dc..8e75b0d4870a 100644 --- a/tests/pos/suspend-strawman/simple-futures.scala +++ b/tests/pos/suspend-strawman/simple-futures.scala @@ -32,7 +32,7 @@ object Future: // a handler for Async def async(body: Async ?=> Unit): Unit = boundary [Unit]: - given Async with + given Async: def await[T](f: Future[T]): T = f.result match case Some(x) => x case None => suspend[T, Unit](s => f.addWaiting(s.resume)) diff --git a/tests/pos/the.scala b/tests/pos/the.scala index 52c6e364fd92..90c56573c7cc 100644 --- a/tests/pos/the.scala +++ b/tests/pos/the.scala @@ -2,7 +2,7 @@ object Test { trait Foo { type T; val x: T } - given intFoo: Foo with { + given intFoo: Foo { type T = Int val x = 3 } diff --git a/tests/pos/toplevel-opaque-xm/Logarithm_1.scala b/tests/pos/toplevel-opaque-xm/Logarithm_1.scala index f2744aaae5af..436097fee478 100644 --- a/tests/pos/toplevel-opaque-xm/Logarithm_1.scala +++ b/tests/pos/toplevel-opaque-xm/Logarithm_1.scala @@ -14,7 +14,7 @@ object Logarithm { def exponent(l: Logarithm): Double = l - given AnyRef with { + given AnyRef { // This is the second way to unlift the logarithm type extension (x: Logarithm) def toDouble: Double = math.exp(x) extension (x: Logarithm) def + (y: Logarithm) = Logarithm(math.exp(x) + math.exp(y)) diff --git a/tests/pos/typeclass-aggregates.scala b/tests/pos/typeclass-aggregates.scala index 5e4551b226b7..bf1a59247170 100644 --- a/tests/pos/typeclass-aggregates.scala +++ b/tests/pos/typeclass-aggregates.scala @@ -42,6 +42,6 @@ val y: Int = ??? : x.Self // given [A, B](using ord: A is Ord, monoid: A is Monoid) => A is Ord & Monoid = // new ord.OrdProxy with monoid.MonoidProxy {} -given [A](using ord: Ord { type Self = A }, monoid: Monoid { type Self = A}): ((Ord & Monoid) { type Self = A}) = +given [A] => (ord: Ord { type Self = A }, monoid: Monoid { type Self = A}) => ((Ord & Monoid) { type Self = A}) = new ord.OrdProxy with monoid.MonoidProxy {} diff --git a/tests/pos/typeclasses-this.scala b/tests/pos/typeclasses-this.scala index 33ccb8d9d653..ebe0dc348a06 100644 --- a/tests/pos/typeclasses-this.scala +++ b/tests/pos/typeclasses-this.scala @@ -36,7 +36,7 @@ end Common object Instances extends Common: - given intOrd: (Int is Ord) with + given intOrd: (Int is Ord): extension (x: Int) def compareTo(y: Int) = if x < y then -1 @@ -44,7 +44,7 @@ object Instances extends Common: else 0 // given [T](using tracked val ev: Ord { type Self = T}): Ord { type Self = List[T] } with - given [T: Ord]: (List[T] is Ord) with + given [T: Ord] => (List[T] is Ord): extension (xs: List[T]) def compareTo(ys: List[T]): Int = (xs, ys) match case (Nil, Nil) => 0 case (Nil, _) => -1 @@ -53,7 +53,7 @@ object Instances extends Common: val fst = x.compareTo(y) if (fst != 0) fst else xs1.compareTo(ys1) - given listMonad: (List is Monad) with + given listMonad: (List is Monad): extension [A](xs: List[A]) def flatMap[B](f: A => List[B]): List[B] = xs.flatMap(f) def pure[A](x: A): List[A] = @@ -61,7 +61,7 @@ object Instances extends Common: type Reader[Ctx] = [X] =>> Ctx => X - given readerMonad[Ctx]: (Reader[Ctx] is Monad) with + given readerMonad: [Ctx] => Reader[Ctx] is Monad: extension [A](r: Ctx => A) def flatMap[B](f: A => Ctx => B): Ctx => B = ctx => f(r(ctx))(ctx) def pure[A](x: A): Ctx => A = @@ -83,7 +83,7 @@ object Instances extends Common: def maximum[T: Ord](xs: List[T]): T = xs.reduce(_ `max` _) - given descending[T: Ord]: (T is Ord) with + given descending: [T: Ord] => T is Ord: extension (x: T) def compareTo(y: T) = T.compareTo(y)(x) def minimum[T: Ord](xs: List[T]) = @@ -123,7 +123,7 @@ class Sheep(val name: String): println(s"$name gets a haircut!") isNaked = true -given Sheep is Animal with +given Sheep is Animal: def apply(name: String) = Sheep(name) extension (self: Self) def name: String = self.name diff --git a/tests/pos/typeclasses.scala b/tests/pos/typeclasses.scala index d0315a318310..40f992cbcb57 100644 --- a/tests/pos/typeclasses.scala +++ b/tests/pos/typeclasses.scala @@ -31,7 +31,7 @@ end Common object Instances extends Common: - given intOrd: (Int is Ord) with + given intOrd: Int is Ord: type Self = Int extension (x: Int) def compareTo(y: Int) = @@ -39,7 +39,7 @@ object Instances extends Common: else if x > y then +1 else 0 - given listOrd[T](using ord: T is Ord): (List[T] is Ord) with + given listOrd: [T] => (ord: T is Ord) => List[T] is Ord: extension (xs: List[T]) def compareTo(ys: List[T]): Int = (xs, ys) match case (Nil, Nil) => 0 case (Nil, _) => -1 @@ -49,7 +49,7 @@ object Instances extends Common: if (fst != 0) fst else xs1.compareTo(ys1) end listOrd - given listMonad: (List is Monad) with + given listMonad: List is Monad: extension [A](xs: List[A]) def flatMap[B](f: A => List[B]): List[B] = xs.flatMap(f) def pure[A](x: A): List[A] = @@ -60,7 +60,7 @@ object Instances extends Common: //given [Ctx] => Reader[Ctx] is Monad as readerMonad: - given readerMonad[Ctx]: (Reader[Ctx] is Monad) with + given readerMonad: [Ctx] => Reader[Ctx] is Monad: extension [A](r: Ctx => A) def flatMap[B](f: A => Ctx => B): Ctx => B = ctx => f(r(ctx))(ctx) def pure[A](x: A): Ctx => A = @@ -132,7 +132,7 @@ instance Sheep: Animal with */ // Implement the `Animal` trait for `Sheep`. -given (Sheep is Animal) with +given Sheep is Animal: def apply(name: String) = Sheep(name) extension (self: Self) def name: String = self.name diff --git a/tests/run-macros/BigFloat/BigFloat_1.scala b/tests/run-macros/BigFloat/BigFloat_1.scala index 5bb5b49587bd..246e3dcd442d 100644 --- a/tests/run-macros/BigFloat/BigFloat_1.scala +++ b/tests/run-macros/BigFloat/BigFloat_1.scala @@ -35,7 +35,7 @@ object BigFloat extends App { def fromDigits(digits: String) = apply(digits) } - given BigFloatFromDigits with { + given BigFloatFromDigits { override inline def fromDigits(digits: String) = ${ BigFloatFromDigitsImpl('digits) } @@ -43,7 +43,7 @@ object BigFloat extends App { // Should be in StdLib: - given ToExpr[BigInt] with { + given ToExpr[BigInt] { def apply(x: BigInt)(using Quotes) = '{BigInt(${Expr(x.toString)})} } diff --git a/tests/run-macros/quoted-liftable-derivation-macro-2/Derivation_1.scala b/tests/run-macros/quoted-liftable-derivation-macro-2/Derivation_1.scala index 1b45835006c0..1212866a3df0 100644 --- a/tests/run-macros/quoted-liftable-derivation-macro-2/Derivation_1.scala +++ b/tests/run-macros/quoted-liftable-derivation-macro-2/Derivation_1.scala @@ -9,7 +9,7 @@ object Lft { given Lft[Int] with def toExpr(x: Int)(using Quotes) = Expr(x) - inline given derived[T](using inline m: Mirror.Of[T]): Lft[T] = ${ derivedExpr('m) } + inline given derived: [T] => (inline m: Mirror.Of[T]) => Lft[T] = ${ derivedExpr('m) } private def derivedExpr[T](mirrorExpr: Expr[Mirror.Of[T]])(using Quotes, Type[T]): Expr[Lft[T]] = { val tpe = summonExprOrError[Type[T]] diff --git a/tests/run/Signals.scala b/tests/run/Signals.scala index bf5232bcd2d4..f6c67eb3df9f 100644 --- a/tests/run/Signals.scala +++ b/tests/run/Signals.scala @@ -29,7 +29,7 @@ package frp: object Signal: type Caller = Signal[?] - given noCaller: Caller(???) with + given noCaller: Caller(???): override def computeValue() = () end Signal diff --git a/tests/run/Typeable.scala b/tests/run/Typeable.scala index 18bf9a4deb6a..58a9838db9a1 100644 --- a/tests/run/Typeable.scala +++ b/tests/run/Typeable.scala @@ -27,13 +27,13 @@ object Typeable: class instanceOf[T: Typeable]: def unapply(x: Any): Option[T] = Typeable[T].cast(x) - given int: Typeable[Int] with + given int: Typeable[Int]: def cast(x: Any): Option[Int] = x match case x: Int => Some(x) case _ => None def describe = "Int" - given list[T: Typeable]: Typeable[List[T]] with + given list: [T: Typeable] => Typeable[List[T]]: def cast(x: Any): Option[List[T]] = x match case x: List[_] if x.forall(Typeable[T].cast(_).isDefined) => Some(x.asInstanceOf[List[T]]) case _ => None diff --git a/tests/run/abstract-givens.scala b/tests/run/abstract-givens.scala index 6ff966411dde..addbf524ba47 100644 --- a/tests/run/abstract-givens.scala +++ b/tests/run/abstract-givens.scala @@ -6,7 +6,7 @@ trait T: object Test extends T, App: given x: Int = 22 override given y(using Int): String = summon[Int].toString - given z[T](using T): Seq[T] with + given z: [T] => T => Seq[T]: override def apply(x: Int) = ??? override def length = ??? override def iterator = ??? diff --git a/tests/run/cochis-example.scala b/tests/run/cochis-example.scala index 93ce9323d2f7..652d58ef0d81 100644 --- a/tests/run/cochis-example.scala +++ b/tests/run/cochis-example.scala @@ -1,7 +1,7 @@ import Predef.{assert, $conforms as _} trait A { - given id[X]: (X => X) = x => x + given id: [X] => (X => X) = x => x def trans[X](x: X)(using f: X => X) = f(x) // (2) } object Test extends A with App{ diff --git a/tests/run/extension-specificity2.scala b/tests/run/extension-specificity2.scala index eeaad80a3687..aa1aef299163 100644 --- a/tests/run/extension-specificity2.scala +++ b/tests/run/extension-specificity2.scala @@ -4,11 +4,11 @@ trait Foo[F[_]]: def test1 = // Simplified from https://github.com/typelevel/spotted-leopards/issues/2 - given listFoo: Foo[List] with + given listFoo: Foo[List]: extension [A](fa: List[A]) def foo[B](fb: List[B]): Int = 1 - given functionFoo[T]: Foo[[A] =>> T => A] with + given functionFoo: [T] => Foo[[A] =>> T => A]: extension [A](fa: T => A) def foo[B](fb: T => B): Int = 2 @@ -23,9 +23,9 @@ def test2 = trait Bar2: extension (x: Int => 1) def bar(y: Int): Int - given bla1[T]: Bar1[T] with + given bla1: [T] => Bar1[T]: extension (x: T => T) def bar(y: T): Int = 1 - given bla2: Bar2 with + given bla2: Bar2: extension (x: Int => 1) def bar(y: Int): Int = 2 val f: Int => 1 = x => 1 diff --git a/tests/run/extmethod-overload.scala b/tests/run/extmethod-overload.scala index 4a9fe125a8a9..46239ed3290b 100644 --- a/tests/run/extmethod-overload.scala +++ b/tests/run/extmethod-overload.scala @@ -97,7 +97,7 @@ object Test extends App { extension (x: Int) def yy(y: Int) = x + y } - given AnyRef with + given AnyRef: extension (x: Int) { def yy (y: Int) = x - y } diff --git a/tests/run/extmethods2.scala b/tests/run/extmethods2.scala index f876b00a9974..a65082dc9e11 100644 --- a/tests/run/extmethods2.scala +++ b/tests/run/extmethods2.scala @@ -2,7 +2,7 @@ object Test extends App { class TC - given stringListOps(using TC): Object with { + given stringListOps: TC => Object { type T = List[String] extension (x: T) def foo(y: T) = (x ++ y, summon[TC]) extension (x: T) def bar(y: Int) = (x(0)(y), summon[TC]) diff --git a/tests/run/fragables-extension.scala b/tests/run/fragables-extension.scala index 417a612a3f04..1fc738af25d8 100644 --- a/tests/run/fragables-extension.scala +++ b/tests/run/fragables-extension.scala @@ -11,11 +11,11 @@ given Fragable[Int] = x => List(IntFrag(x)) given Fragable[String] = x => List(StringFrag(x)) -given [A: Fragable]: Fragable[List[A]] = +given [A: Fragable] => Fragable[List[A]] = x => x.flatMap(_.toFrags) given Fragable[EmptyTuple] = x => Nil -given [A: Fragable, B <: Tuple: Fragable]: Fragable[A *: B] = +given [A: Fragable, B <: Tuple: Fragable] => Fragable[A *: B] = x => x.head.toFrags ++ x.tail.toFrags def f[T: Fragable](x: T) = diff --git a/tests/run/genericNumLits.scala b/tests/run/genericNumLits.scala index 7f91ab0b3ef5..7d1737903d21 100644 --- a/tests/run/genericNumLits.scala +++ b/tests/run/genericNumLits.scala @@ -10,7 +10,7 @@ object Test extends App { case class Even(n: Int) - given FromDigits[Even] with { + given FromDigits[Even] { def fromDigits(digits: String): Even = { val intValue = digits.toInt if (intValue % 2 == 0) Even(intValue) diff --git a/tests/run/given-eta.scala b/tests/run/given-eta.scala index a01f1c441018..571125f2b4c5 100644 --- a/tests/run/given-eta.scala +++ b/tests/run/given-eta.scala @@ -12,7 +12,7 @@ def g(x: Int)(using d: D) (y: d.T): d.T = d.trans(y) val x = f assert(x(2)(3) == 6) - given D with + given D: type T = Int def trans(other: T) = 2 * other val y = g diff --git a/tests/run/i11050.scala b/tests/run/i11050.scala index 027812c013c4..34613fdaf5fd 100644 --- a/tests/run/i11050.scala +++ b/tests/run/i11050.scala @@ -107,9 +107,9 @@ trait Show[-T]: def show(x: T): String object Show: - given Show[Int] with { def show(x: Int) = s"$x" } - given Show[Char] with { def show(x: Char) = s"'$x'" } - given Show[String] with { def show(x: String) = s"$"$x$"" } + given Show[Int] { def show(x: Int) = s"$x" } + given Show[Char] { def show(x: Char) = s"'$x'" } + given Show[String] { def show(x: String) = s"$"$x$"" } inline def show[T](x: T): String = summonInline[Show[T]].show(x) diff --git a/tests/run/i11174.scala b/tests/run/i11174.scala index 644d3144d8d8..89759d37b076 100644 --- a/tests/run/i11174.scala +++ b/tests/run/i11174.scala @@ -38,7 +38,7 @@ class MainClass { case Square(width: Int, height: Int) extends Shape case Circle(radius: Int) extends Shape - given EnumerateNames[Int] with { + given EnumerateNames[Int] { def apply: String = "int" } inline given auto[T]:EnumerateNames[T] = EnumerateNames.derived diff --git a/tests/run/i11174local.scala b/tests/run/i11174local.scala index a0c9b8e253b9..1f18c67680d9 100644 --- a/tests/run/i11174local.scala +++ b/tests/run/i11174local.scala @@ -34,10 +34,10 @@ trait EnumerateNames[T] { } class MainClass { - given EnumerateNames[Int] with { + given EnumerateNames[Int] { def apply: String = "int" } - inline given auto[T]: EnumerateNames[T] = EnumerateNames.derived + inline given auto: [T] => EnumerateNames[T] = EnumerateNames.derived def deriveEnumerateNames[T](using en: EnumerateNames[T]) = en.apply def run = { diff --git a/tests/run/i11542.scala b/tests/run/i11542.scala index 32e940e745d0..2d799f4233f9 100644 --- a/tests/run/i11542.scala +++ b/tests/run/i11542.scala @@ -14,7 +14,7 @@ object demo { childReaders: List[Reader[_]] ) extends Reader[A] - inline given rdr[A <: Tuple](using m: deriving.Mirror.ProductOf[A]): Reader[A] = { + inline given rdr: [A <: Tuple] => (m: deriving.Mirror.ProductOf[A]) => Reader[A] = { new CombinedReader(m, summonReader[m.MirroredElemTypes]) } diff --git a/tests/run/i11542a.scala b/tests/run/i11542a.scala index db4142fb1a86..37a0c816d1f2 100644 --- a/tests/run/i11542a.scala +++ b/tests/run/i11542a.scala @@ -1,6 +1,6 @@ type Foo = Tuple2[Int, Int] // case class Foo(x: Int, y: Int) // works class Reader(m: deriving.Mirror.ProductOf[Foo]) -given reader1(using m: deriving.Mirror.ProductOf[Foo]): Reader = new Reader(m) +given reader1: (m: deriving.Mirror.ProductOf[Foo]) => Reader = new Reader(m) inline def summonReader(): Reader = compiletime.summonInline[Reader] @main def Test() = summonReader() diff --git a/tests/run/i11563.scala b/tests/run/i11563.scala index 97f60140e402..182bcc11927e 100644 --- a/tests/run/i11563.scala +++ b/tests/run/i11563.scala @@ -4,7 +4,7 @@ import scala.deriving.Mirror trait Printer[T]: def format: String -given Printer[String] with +given Printer[String]: def format: String = "String" inline given[T](using mirror: Mirror.ProductOf[T]): Printer[T] = Printer.derived[T] diff --git a/tests/run/i11583.scala b/tests/run/i11583.scala index fd4d63faa084..bbb00671e528 100644 --- a/tests/run/i11583.scala +++ b/tests/run/i11583.scala @@ -20,11 +20,11 @@ extension [A](a: A) @main def Test = - given Context with + given Context: type Type = String type Term = Boolean - given Env with + given Env: type Extra = Int val t1: (String, Boolean, Int) = true.:#:("hello")(23) diff --git a/tests/run/i11961.scala b/tests/run/i11961.scala index f289f6b415b6..1ecb205b2ba5 100644 --- a/tests/run/i11961.scala +++ b/tests/run/i11961.scala @@ -17,10 +17,10 @@ trait Printable[T]: object Printable: - given Printable[String] with + given Printable[String]: def print: Unit = println("STRING") - given Printable[Boolean] with + given Printable[Boolean]: def print: Unit = println("BOOLEAN") def printProduct[T](p: Mirror.ProductOf[T], elems: => List[Printable[_]]): Printable[T] = @@ -28,7 +28,7 @@ object Printable: def print: Unit = elems.foreach(_.print) - inline given derived[T](using m: Mirror.Of[T]): Printable[T] = + inline given derived: [T] => (m: Mirror.Of[T]) => Printable[T] = val elemInstances = summonAllPrintable[m.MirroredElemTypes] inline m match case p: Mirror.ProductOf[T] => printProduct(p, elemInstances) diff --git a/tests/run/i11966.scala b/tests/run/i11966.scala index 184e68f7599c..57956b9d7274 100644 --- a/tests/run/i11966.scala +++ b/tests/run/i11966.scala @@ -6,11 +6,11 @@ trait B[T: A]: trait C[T: A] extends B[T] -given a1: A[Int] with +given a1: A[Int]: def f = 1 class D extends C[Int]: - given a2: A[Int] with + given a2: A[Int]: def f = 2 @main def Test = D() diff --git a/tests/run/i12328.scala b/tests/run/i12328.scala index 0f9f00ca19aa..04e97c618e10 100644 --- a/tests/run/i12328.scala +++ b/tests/run/i12328.scala @@ -20,7 +20,7 @@ object Schema { new Schema[T] { } } - inline given gen[T]: Schema[T] = derived + inline given gen: [T] => Schema[T] = derived } @main def Test: Unit = { diff --git a/tests/run/i13146.scala b/tests/run/i13146.scala index cbaee29a5ec0..6d77e6ddc209 100644 --- a/tests/run/i13146.scala +++ b/tests/run/i13146.scala @@ -10,7 +10,7 @@ trait Eq[-T]: def eqv(x: T, y: T): Boolean object Eq: - given Eq[Int] with + given Eq[Int]: def eqv(x: Int, y: Int) = x == y def check(elem: Eq[_])(x: Any, y: Any): Boolean = @@ -31,7 +31,7 @@ object Eq: case ((x, y), elem) => check(elem)(x, y) } - inline given derived[T](using m: Mirror.Of[T]): Eq[T] = + inline given derived: [T] => (m: Mirror.Of[T]) => Eq[T] = lazy val elemInstances = summonAll[m.MirroredElemTypes] inline m match case s: Mirror.SumOf[T] => eqSum(s, elemInstances) @@ -43,7 +43,7 @@ enum Opt[+T]: case Nn object Opt: - given derivedEq[T]: Eq[Opt[T]] = Eq.derived + given derivedEq: [T] => Eq[Opt[T]] = Eq.derived @main def Test(): Unit = import Opt.* diff --git a/tests/run/i13146a.scala b/tests/run/i13146a.scala index 37e135ac9f76..f9df675510e3 100644 --- a/tests/run/i13146a.scala +++ b/tests/run/i13146a.scala @@ -26,7 +26,7 @@ trait Eq[-T]: object Eq: - given Eq[Int] with + given Eq[Int]: def eqv(x: Int, y: Int) = x == y def check(elem: Eq[_])(x: Any, y: Any): Boolean = @@ -47,7 +47,7 @@ object Eq: case ((x, y), elem) => check(elem)(x, y) } - inline given derived[T](using m: Mirror.Of[T]): Eq[T] = + inline given derived: [T] => (m: Mirror.Of[T]) => Eq[T] = lazy val elemInstances = summonAll[T, m.MirroredElemTypes] inline m match case s: Mirror.SumOf[T] => eqSum(s, elemInstances) diff --git a/tests/run/i13146poly.scala b/tests/run/i13146poly.scala index 849f4dc7eb52..1d011221b931 100644 --- a/tests/run/i13146poly.scala +++ b/tests/run/i13146poly.scala @@ -3,10 +3,10 @@ import scala.deriving.* trait Functor[F[_]] object Functor: - given [C]: Functor[[T] =>> C]() + given [C] => Functor[[T] =>> C]() given Functor[[T] =>> Tuple1[T]]() - given t2 [T]: Functor[[U] =>> (T, U)]() - given t3 [T, U]: Functor[[V] =>> (T, U, V)]() + given t2: [T] => Functor[[U] =>> (T, U)]() + given t3: [T, U] => Functor[[V] =>> (T, U, V)]() def derived[F[_]](using m: Mirror { type MirroredType[X] = F[X] ; type MirroredElemTypes[_] }, r: Functor[m.MirroredElemTypes]): Functor[F] = new Functor[F] {} diff --git a/tests/run/i13304.scala b/tests/run/i13304.scala index f60359b82d47..f8e50f004848 100644 --- a/tests/run/i13304.scala +++ b/tests/run/i13304.scala @@ -1,10 +1,10 @@ trait Zero[F[_]]: def zero[A]: F[A] -given Zero[List] with +given Zero[List]: def zero[A] = List.empty[A] -given Zero[Option] with +given Zero[Option]: def zero[A] = Option.empty[A] diff --git a/tests/run/i13332shapeless.scala b/tests/run/i13332shapeless.scala index 204980d8fe62..fe63a9ba6855 100644 --- a/tests/run/i13332shapeless.scala +++ b/tests/run/i13332shapeless.scala @@ -119,7 +119,7 @@ package GenericTestsAux2 { class Bar[A] object Bar { - given gen[A](using Generic[A]): Bar[A] = Bar() + given gen: [A: Generic] => Bar[A] = Bar() } class Outer1 { @@ -362,7 +362,7 @@ package shapeless { case Mirror.Sum { type MirroredType = T } => CListRefl[Elems] case Mirror.Product { type MirroredType = T } => Elems - transparent inline given [T](using m: Mirror.Of[T]): Generic[T] = apply[T] + transparent inline given [T: Mirror.Of] => Generic[T] = apply[T] transparent inline def apply[T](using m: Mirror.Of[T]) = new Generic[T] { type Repr = Generic.Repr[T, m.type, m.MirroredElemTypes] diff --git a/tests/run/i14150.scala b/tests/run/i14150.scala index 9ddfaf342bb9..89060333105b 100644 --- a/tests/run/i14150.scala +++ b/tests/run/i14150.scala @@ -22,7 +22,7 @@ object GetConstValue { } } - given empty : GetConstValue[EmptyTuple] with { + given empty : GetConstValue[EmptyTuple] { type Out = EmptyTuple def get : Out = EmptyTuple } diff --git a/tests/run/i17115.scala b/tests/run/i17115.scala index 5a7cac5d0dc1..5c82cf13a8ad 100644 --- a/tests/run/i17115.scala +++ b/tests/run/i17115.scala @@ -1,6 +1,6 @@ trait A[T <: Tuple] { val x: Int } -given empty: A[EmptyTuple] with { val x = 1 } -given inductive[Tup <: NonEmptyTuple](using A[Tuple.Tail[Tup]]): A[Tup] with { val x = summon[A[Tuple.Tail[Tup]]].x + 1 } +given empty: A[EmptyTuple] { val x = 1 } +given inductive: [Tup <: NonEmptyTuple] => A[Tuple.Tail[Tup]] => A[Tup] { val x = summon[A[Tuple.Tail[Tup]]].x + 1 } object Test: def main(args: Array[String]): Unit = diff --git a/tests/run/i6716.scala b/tests/run/i6716.scala index e793381cce1c..c0678c51fb30 100644 --- a/tests/run/i6716.scala +++ b/tests/run/i6716.scala @@ -4,7 +4,7 @@ trait Monad[T]: def id: String class Foo object Foo { - given Monad[Foo] with { def id = "Foo" } + given Monad[Foo] { def id = "Foo" } } opaque type Bar = Foo diff --git a/tests/run/i7788.scala b/tests/run/i7788.scala index 99d16ba1521c..3dc4d247ad94 100644 --- a/tests/run/i7788.scala +++ b/tests/run/i7788.scala @@ -4,9 +4,9 @@ trait Show[-A]: given Show[String] = x => x given Show[Int] = _.toString -given showEither[A,B](using sA: Show[A])(using Show[B]): Show[Either[A,B]] = +given showEither: [A,B] => (sA: Show[A]) => Show[B] => Show[Either[A,B]] = _.fold(a => s"Left(${summon[Show[A]].show(a)})", b => s"Right(${summon[Show[B]].show(b)})") -given [A,B](using sA: Show[A])(using sB: Show[B]): Show[(A,B)] = (a,b) => s"(${sA.show(a)}), ${sB.show(b)})" +given [A,B] => (sA: Show[A]) => (sB: Show[B]) => Show[(A,B)] = (a,b) => s"(${sA.show(a)}), ${sB.show(b)})" @main def Test = diff --git a/tests/run/i9011.scala b/tests/run/i9011.scala index 22ab9bc1e1a6..13afbf1a4297 100644 --- a/tests/run/i9011.scala +++ b/tests/run/i9011.scala @@ -10,7 +10,7 @@ trait Eq[T] { } object Eq { - given Eq[Int] with { + given Eq[Int] { def eqv(x: Int, y: Int) = x == y } @@ -40,7 +40,7 @@ object Eq { } } - inline given derived[T](using m: Mirror.Of[T]): Eq[T] = { + inline given derived: [T] => (m: Mirror.Of[T]) => Eq[T] = { val elemInstances = summonAll[m.MirroredElemTypes] inline m match { case s: Mirror.SumOf[T] => eqSum(s, elemInstances) diff --git a/tests/run/i9473.scala b/tests/run/i9473.scala index 384870ea42af..4b4e8d4c1d07 100644 --- a/tests/run/i9473.scala +++ b/tests/run/i9473.scala @@ -11,7 +11,7 @@ trait Eq[T] { } object Eq { - given Eq[Int] with { + given Eq[Int] { def eqv(x: Int, y: Int) = x == y } @@ -36,7 +36,7 @@ object Eq { } } - inline given derived[T](using m: Mirror.Of[T]): Eq[T] = { + inline given derived: [T] => (m: Mirror.Of[T]) => Eq[T] = { lazy val elemInstances = summonAll[m.MirroredElemTypes] inline m match { case s: Mirror.SumOf[T] => eqSum(s, elemInstances) diff --git a/tests/run/i9530.scala b/tests/run/i9530.scala index e0262764039f..0c003a4bf475 100644 --- a/tests/run/i9530.scala +++ b/tests/run/i9530.scala @@ -13,7 +13,7 @@ extension (using s: Scope)(expr: s.Expr) def f(using s: Scope)(x: s.Expr): (String, s.Value) = (x.show, x.eval) -given scope: Scope with +given scope: Scope: case class Expr(str: String) type Value = Int def expr(x: String) = Expr(x) diff --git a/tests/run/i9928.scala b/tests/run/i9928.scala index 3a3f818b17d3..6e4149ef6538 100644 --- a/tests/run/i9928.scala +++ b/tests/run/i9928.scala @@ -2,7 +2,7 @@ trait Magic[F]: extension (x: Int) def read: F trait LowPrio: - given Magic[String] with + given Magic[String]: extension(x: Int) def read: String = println("In string") s"$x" @@ -15,7 +15,7 @@ object test1: import Magic.given def apply(s: String): Foo = s - given Magic[Foo] with + given Magic[Foo]: extension (x: Int) def read: Foo = println("In foo") Foo(s"$x") @@ -25,7 +25,7 @@ object test1: object test2: object Magic extends LowPrio: - given Magic[Foo] with + given Magic[Foo]: extension (x: Int) def read: Foo = println("In foo") Foo(s"$x") diff --git a/tests/run/ift-return.scala b/tests/run/ift-return.scala index 021c73173051..b49f4c647ee0 100644 --- a/tests/run/ift-return.scala +++ b/tests/run/ift-return.scala @@ -11,9 +11,9 @@ def f(x: Boolean): A ?=> (c: Ctx) ?=> (Int, c.T) = (summon[A].x, summon[Ctx].y) @main def Test = - given A with + given A: val x = 22 - given Ctx with + given Ctx: type T = String val x = "abc" val y = "def" diff --git a/tests/run/implicit-alias.scala b/tests/run/implicit-alias.scala index 64117c3fc977..b376e1635496 100644 --- a/tests/run/implicit-alias.scala +++ b/tests/run/implicit-alias.scala @@ -60,7 +60,7 @@ object Test extends App { locally { println("with type params") - given t[X]: TC = new TC + given t: [X] => TC = new TC summon[TC] summon[TC] } diff --git a/tests/run/implicit-specifity.scala b/tests/run/implicit-specifity.scala index 9e59cf5f1869..b12fe5b2788f 100644 --- a/tests/run/implicit-specifity.scala +++ b/tests/run/implicit-specifity.scala @@ -5,19 +5,19 @@ object Show { def apply[T](implicit st: Show[T]): Int = st.i given showInt: Show[Int] = new Show[Int](0) - given fallback[T]: Show[T] = new Show[T](1) + given fallback: [T] => Show[T] = new Show[T](1) } class Generic object Generic { given gen: Generic = new Generic - given showGen[T](using Generic): Show[T] = new Show[T](2) + given showGen: [T] => Generic => Show[T] = new Show[T](2) } class Generic2 object Generic2 { opaque type HiPriority = AnyRef - given showGen[T]: (Show[T] & HiPriority) = new Show[T](2).asInstanceOf + given showGen: [T] => Show[T] & HiPriority = new Show[T](2).asInstanceOf } class SubGen extends Generic @@ -29,11 +29,11 @@ object Contextual { given ctx: Context() - given showGen[T](using Generic): Show[T] = new Show[T](2) + given showGen: [T] => Generic => Show[T] = new Show[T](2) - given showGen[T](using Generic, Context): Show[T] = new Show[T](3) + given showGen: [T] => (Generic, Context) => Show[T] = new Show[T](3) - given showGen[T](using SubGen): Show[T] = new Show[T](4) + given showGen: [T] => SubGen => Show[T] = new Show[T](4) } object Test extends App { diff --git a/tests/run/implied-priority.scala b/tests/run/implied-priority.scala index a9380e117875..52eb07f1679d 100644 --- a/tests/run/implied-priority.scala +++ b/tests/run/implied-priority.scala @@ -77,12 +77,12 @@ def test2a = { */ object Impl3 { trait LowPriority // A marker trait to indicate a lower priority - given t1[T]: E[T]("low") with LowPriority + given t1: [T] => E[T]("low"), LowPriority } object Override { - given over[T]: E[T]("hi") with {} + given over: [T] => E[T]("hi") } def test3 = { @@ -135,7 +135,7 @@ object HigherPriority { } object fallback5 { - given [T](using ev: E[T] = new E[T]("fallback")): (E[T] & HigherPriority.Type) = HigherPriority.inject(ev) + given [T] => (ev: E[T] = new E[T]("fallback")) => E[T] & HigherPriority.Type = HigherPriority.inject(ev) } def test5 = { diff --git a/tests/run/inline-numeric/Fractional.scala b/tests/run/inline-numeric/Fractional.scala index f1bc81246a43..e88442e42c9d 100644 --- a/tests/run/inline-numeric/Fractional.scala +++ b/tests/run/inline-numeric/Fractional.scala @@ -17,13 +17,13 @@ trait Fractional[T] extends Numeric[T]: transparent inline def /(inline y: T) = div(x, y) object Fractional: - given BigDecimalIsFractional: BigDecimalIsConflicted with Fractional[BigDecimal] with + given BigDecimalIsFractional: BigDecimalIsConflicted, Fractional[BigDecimal]: transparent inline def div(inline x: BigDecimal, inline y: BigDecimal): BigDecimal = x / y protected transparent inline def isNaN(inline x: BigDecimal): Boolean = false protected transparent inline def isNegZero(inline x: BigDecimal): Boolean = false - given DoubleIsFractional: Fractional[Double] with Ordering.DoubleIeeeOrdering with + given DoubleIsFractional: Fractional[Double], Ordering.DoubleIeeeOrdering: transparent inline def plus(inline x: Double, inline y: Double): Double = x + y transparent inline def minus(inline x: Double, inline y: Double): Double = x - y transparent inline def times(inline x: Double, inline y: Double): Double = x * y @@ -42,7 +42,7 @@ object Fractional: transparent inline def toFloat: Float = x.toFloat transparent inline def toDouble: Double = x - given FloatIsFractional: Fractional[Float] with Ordering.FloatIeeeOrdering with + given FloatIsFractional: Fractional[Float], Ordering.FloatIeeeOrdering: transparent inline def plus(inline x: Float, inline y: Float): Float = x + y transparent inline def minus(inline x: Float, inline y: Float): Float = x - y transparent inline def times(inline x: Float, inline y: Float): Float = x * y diff --git a/tests/run/inline-numeric/Integral.scala b/tests/run/inline-numeric/Integral.scala index 1a740a3e1d99..3b199aad6b11 100644 --- a/tests/run/inline-numeric/Integral.scala +++ b/tests/run/inline-numeric/Integral.scala @@ -19,11 +19,11 @@ trait Integral[T] extends Numeric[T]: transparent inline def /%(inline y: T) = (quot(x, y), rem(x, y)) object Integral: - given BigDecimalAsIfIntegral: Integral[BigDecimal] with BigDecimalIsConflicted with + given BigDecimalAsIfIntegral: Integral[BigDecimal], BigDecimalIsConflicted: transparent inline def quot(inline x: BigDecimal, inline y: BigDecimal): BigDecimal = x quot y transparent inline def rem(inline x: BigDecimal, inline y: BigDecimal): BigDecimal = x remainder y - given BigIntIsIntegral: Integral[BigInt] with Ordering.BigIntOrdering with + given BigIntIsIntegral: Integral[BigInt], Ordering.BigIntOrdering: transparent inline def plus(inline x: BigInt, inline y: BigInt): BigInt = x + y transparent inline def minus(inline x: BigInt, inline y: BigInt): BigInt = x - y transparent inline def times(inline x: BigInt, inline y: BigInt): BigInt = x * y @@ -41,7 +41,7 @@ object Integral: transparent inline def quot(inline x: BigInt, inline y: BigInt): BigInt = x / y transparent inline def rem(inline x: BigInt, inline y: BigInt): BigInt = x % y - given ByteIsIntegral: Integral[Byte] with Ordering.ByteOrdering with + given ByteIsIntegral: Integral[Byte], Ordering.ByteOrdering: transparent inline def plus(inline x: Byte, inline y: Byte): Byte = (x + y).toByte transparent inline def minus(inline x: Byte, inline y: Byte): Byte = (x - y).toByte transparent inline def times(inline x: Byte, inline y: Byte): Byte = (x * y).toByte @@ -59,7 +59,7 @@ object Integral: transparent inline def toFloat: Float = x.toFloat transparent inline def toDouble: Double = x.toDouble - given CharIsIntegral: Integral[Char] with Ordering.CharOrdering with + given CharIsIntegral: Integral[Char], Ordering.CharOrdering: transparent inline def plus(inline x: Char, inline y: Char): Char = (x + y).toChar transparent inline def minus(inline x: Char, inline y: Char): Char = (x - y).toChar transparent inline def times(inline x: Char, inline y: Char): Char = (x * y).toChar @@ -77,7 +77,7 @@ object Integral: transparent inline def toFloat: Float = x.toFloat transparent inline def toDouble: Double = x.toDouble - given IntIsIntegral: Integral[Int] with Ordering.IntOrdering with + given IntIsIntegral: Integral[Int], Ordering.IntOrdering: transparent inline def plus(inline x: Int, inline y: Int): Int = x + y transparent inline def minus(inline x: Int, inline y: Int): Int = x - y transparent inline def times(inline x: Int, inline y: Int): Int = x * y @@ -95,7 +95,7 @@ object Integral: transparent inline def toFloat: Float = x.toFloat transparent inline def toDouble: Double = x.toDouble - given LongIsIntegral: Integral[Long] with Ordering.LongOrdering with + given LongIsIntegral: Integral[Long], Ordering.LongOrdering: transparent inline def plus(inline x: Long, inline y: Long): Long = x + y transparent inline def minus(inline x: Long, inline y: Long): Long = x - y transparent inline def times(inline x: Long, inline y: Long): Long = x * y @@ -113,7 +113,7 @@ object Integral: transparent inline def toFloat: Float = x.toFloat transparent inline def toDouble: Double = x.toDouble - given ShortIsIntegral: Integral[Short] with Ordering.ShortOrdering with + given ShortIsIntegral: Integral[Short], Ordering.ShortOrdering: transparent inline def plus(inline x: Short, inline y: Short): Short = (x + y).toShort transparent inline def minus(inline x: Short, inline y: Short): Short = (x - y).toShort transparent inline def times(inline x: Short, inline y: Short): Short = (x * y).toShort diff --git a/tests/run/instances-anonymous.scala b/tests/run/instances-anonymous.scala index 7a42496504ee..7fc0f69ee736 100644 --- a/tests/run/instances-anonymous.scala +++ b/tests/run/instances-anonymous.scala @@ -16,7 +16,7 @@ object Test extends App { println(circle.circumference) - given AnyRef with { + given AnyRef { extension (xs: Seq[String]) def longestStrings: Seq[String] = { val maxLength = xs.map(_.length).max xs.filter(_.length == maxLength) @@ -45,7 +45,7 @@ object Test extends App { def unit: T } - given Monoid[String] with { + given Monoid[String] { extension (x: String) def combine(y: String): String = x.concat(y) def unit: String = "" } @@ -63,13 +63,13 @@ object Test extends App { val minimum: T } - given Ord[Int] with { + given Ord[Int] { extension (x: Int) def compareTo(y: Int) = if (x < y) -1 else if (x > y) +1 else 0 val minimum = Int.MinValue } - given [T: Ord]: Ord[List[T]] with { + given [T: Ord] => Ord[List[T]] { extension (xs: List[T]) def compareTo(ys: List[T]): Int = (xs, ys).match { case (Nil, Nil) => 0 case (Nil, _) => -1 @@ -101,14 +101,14 @@ object Test extends App { def pure[A](x: A): F[A] } - given Monad[List] with { + given Monad[List] { extension [A](xs: List[A]) def flatMap[B](f: A => List[B]): List[B] = xs.flatMap(f) def pure[A](x: A): List[A] = List(x) } - given [Ctx]: Monad[[X] =>> Ctx => X] with { + given [Ctx] => Monad[[X] =>> Ctx => X] { extension [A](r: Ctx => A) def flatMap[B](f: A => Ctx => B): Ctx => B = ctx => f(r(ctx))(ctx) def pure[A](x: A): Ctx => A = diff --git a/tests/run/instances.scala b/tests/run/instances.scala index 128ea0700e02..1e1d908cbddf 100644 --- a/tests/run/instances.scala +++ b/tests/run/instances.scala @@ -46,7 +46,7 @@ object Test extends App { trait Monoid[T] extends SemiGroup[T]: def unit: T - given StringMonoid: Monoid[String] with + given StringMonoid: Monoid[String]: extension (x: String) def combine(y: String): String = x.concat(y) def unit: String = "" @@ -63,12 +63,12 @@ object Test extends App { val minimum: T end Ord - given Ord[Int] with + given Ord[Int]: extension (x: Int) def compareTo(y: Int) = if (x < y) -1 else if (x > y) +1 else 0 val minimum = Int.MinValue - given listOrd[T: Ord]: Ord[List[T]] with + given listOrd: [T: Ord] => Ord[List[T]]: extension (xs: List[T]) def compareTo(ys: List[T]): Int = (xs, ys).match case (Nil, Nil) => 0 case (Nil, _) => -1 @@ -99,13 +99,13 @@ object Test extends App { def pure[A](x: A): F[A] end Monad - given listMonad: Monad[List] with + given listMonad: Monad[List]: extension [A](xs: List[A]) def flatMap[B](f: A => List[B]): List[B] = xs.flatMap(f) def pure[A](x: A): List[A] = List(x) - given readerMonad[Ctx]: Monad[[X] =>> Ctx => X] with + given readerMonad: [Ctx] => Monad[[X] =>> Ctx => X]: extension [A](r: Ctx => A) def flatMap[B](f: A => Ctx => B): Ctx => B = ctx => f(r(ctx))(ctx) def pure[A](x: A): Ctx => A = diff --git a/tests/run/poly-kinded-derives.scala b/tests/run/poly-kinded-derives.scala index 0d3c7e9f8ffd..627d2780a802 100644 --- a/tests/run/poly-kinded-derives.scala +++ b/tests/run/poly-kinded-derives.scala @@ -22,10 +22,10 @@ object Test extends App { { trait Functor[F[_]] object Functor { - given [C]: Functor[[T] =>> C]() + given [C] => Functor[[T] =>> C]() given Functor[[T] =>> Tuple1[T]]() - given t2 [T]: Functor[[U] =>> (T, U)]() - given t3 [T, U]: Functor[[V] =>> (T, U, V)]() + given t2: [T] => Functor[[U] =>> (T, U)]() + given t3: [T, U] => Functor[[V] =>> (T, U, V)]() def derived[F[_]](using m: Mirror { type MirroredType[X] = F[X] ; type MirroredElemTypes[_] }, r: Functor[m.MirroredElemTypes]): Functor[F] = new Functor[F] {} } @@ -40,8 +40,8 @@ object Test extends App { { trait FunctorK[F[_[_]]] object FunctorK { - given [C]: FunctorK[[F[_]] =>> C]() - given [T]: FunctorK[[F[_]] =>> Tuple1[F[T]]]() + given [C] => FunctorK[[F[_]] =>> C]() + given [T] => FunctorK[[F[_]] =>> Tuple1[F[T]]]() def derived[F[_[_]]](using m: Mirror { type MirroredType[X[_]] = F[X] ; type MirroredElemTypes[_[_]] }, r: FunctorK[m.MirroredElemTypes]): FunctorK[F] = new FunctorK[F] {} } @@ -56,10 +56,10 @@ object Test extends App { { trait Bifunctor[F[_, _]] object Bifunctor { - given [C]: Bifunctor[[T, U] =>> C]() + given [C] => Bifunctor[[T, U] =>> C]() given Bifunctor[[T, U] =>> Tuple1[U]]() given t2: Bifunctor[[T, U] =>> (T, U)]() - given t3 [T]: Bifunctor[[U, V] =>> (T, U, V)]() + given t3: [T] => Bifunctor[[U, V] =>> (T, U, V)]() def derived[F[_, _]](using m: Mirror { type MirroredType[X, Y] = F[X, Y] ; type MirroredElemTypes[_, _] }, r: Bifunctor[m.MirroredElemTypes]): Bifunctor[F] = ??? } diff --git a/tests/run/publicInBinary/Lib_1.scala b/tests/run/publicInBinary/Lib_1.scala index d9936670a458..e7b5a0780d1c 100644 --- a/tests/run/publicInBinary/Lib_1.scala +++ b/tests/run/publicInBinary/Lib_1.scala @@ -47,9 +47,9 @@ class Qux() extends Foo(5, 5): trait A[T]: def f: T -@publicInBinary given A[Int] with +@publicInBinary given A[Int]: def f: Int = 1 -@publicInBinary given (using Double): A[Int] with +@publicInBinary given Double => A[Int]: def f: Int = 1 package inlines { diff --git a/tests/run/string-context-implicits-with-conversion.scala b/tests/run/string-context-implicits-with-conversion.scala index adcbae38830c..7173155e5bf9 100644 --- a/tests/run/string-context-implicits-with-conversion.scala +++ b/tests/run/string-context-implicits-with-conversion.scala @@ -4,7 +4,7 @@ object Lib { opaque type Showed = String - given [T](using show: Show[T]): Conversion[T, Showed] = x => show(x) + given [T] => (show: Show[T]) => Conversion[T, Showed] = x => show(x) trait Show[T] { def apply(x: T): String diff --git a/tests/run/structural-contextual.scala b/tests/run/structural-contextual.scala index e1d0890b73cd..43872856e4ed 100644 --- a/tests/run/structural-contextual.scala +++ b/tests/run/structural-contextual.scala @@ -15,7 +15,7 @@ type Person = ResolvingSelectable { @main def Test = - given Resolver with + given Resolver: def resolve(label: String) = label match case "name" => "Emma" case "age" => 8 diff --git a/tests/run/tagless.scala b/tests/run/tagless.scala index 5abc32d84578..7c1ffd3b433c 100644 --- a/tests/run/tagless.scala +++ b/tests/run/tagless.scala @@ -40,12 +40,12 @@ object Test extends App { add(lit(8), neg(add(lit(1), lit(2)))) // Base operations as type classes - given Exp[Int] with + given Exp[Int]: def lit(i: Int): Int = i def neg(t: Int): Int = -t def add(l: Int, r: Int): Int = l + r - given Exp[String] with + given Exp[String]: def lit(i: Int): String = i.toString def neg(t: String): String = s"(-$t)" def add(l: String, r: String): String = s"($l + $r)" @@ -65,10 +65,10 @@ object Test extends App { def tfm1[T: Exp : Mult] = add(lit(7), neg(mul(lit(1), lit(2)))) def tfm2[T: Exp : Mult] = mul(lit(7), tf1) - given Mult[Int] with + given Mult[Int]: def mul(l: Int, r: Int): Int = l * r - given Mult[String] with + given Mult[String]: def mul(l: String, r: String): String = s"$l * $r" println(tfm1[Int]) @@ -83,7 +83,7 @@ object Test extends App { } import Tree.* - given Exp[Tree] with Mult[Tree] with + given Exp[Tree], Mult[Tree]: def lit(i: Int): Tree = Node("Lit", Leaf(i.toString)) def neg(t: Tree): Tree = Node("Neg", t) def add(l: Tree, r: Tree): Tree = Node("Add", l , r) @@ -148,7 +148,7 @@ object Test extends App { def value[T](using Exp[T]): T } - given Exp[Wrapped] with + given Exp[Wrapped]: def lit(i: Int) = new Wrapped { def value[T](using e: Exp[T]): T = e.lit(i) } @@ -190,7 +190,7 @@ object Test extends App { // Added operation: negation pushdown enum NCtx { case Pos, Neg } - given [T](using e: Exp[T]): Exp[NCtx => T] with + given [T] => (e: Exp[T]) => Exp[NCtx => T]: import NCtx.* def lit(i: Int) = { case Pos => e.lit(i) @@ -209,7 +209,7 @@ object Test extends App { println(pushNeg(tf1[NCtx => String])) println(pushNeg(pushNeg(pushNeg(tf1))): String) - given [T](using e: Mult[T]): Mult[NCtx => T] with + given [T] => (e: Mult[T]) => Mult[NCtx => T]: import NCtx.* def mul(l: NCtx => T, r: NCtx => T): NCtx => T = { case Pos => e.mul(l(Pos), r(Pos)) @@ -222,7 +222,7 @@ object Test extends App { import IExp.* // Going from type class encoding to ADT encoding - given initialize: Exp[IExp] with + given initialize: Exp[IExp]: def lit(i: Int): IExp = Lit(i) def neg(t: IExp): IExp = Neg(t) def add(l: IExp, r: IExp): IExp = Add(l, r) diff --git a/tests/run/typeclass-derivation-doc-example.scala b/tests/run/typeclass-derivation-doc-example.scala index bc00311478bd..71c811608f5a 100644 --- a/tests/run/typeclass-derivation-doc-example.scala +++ b/tests/run/typeclass-derivation-doc-example.scala @@ -11,7 +11,7 @@ trait Eq[T] { } object Eq { - given Eq[Int] with { + given Eq[Int] { def eqv(x: Int, y: Int) = x == y } @@ -36,7 +36,7 @@ object Eq { } } - inline given derived[T](using m: Mirror.Of[T]): Eq[T] = { + inline given derived: [T] => (m: Mirror.Of[T]) => Eq[T] = { val elemInstances = summonAll[m.MirroredElemTypes] inline m match { case s: Mirror.SumOf[T] => eqSum(s, elemInstances) diff --git a/tests/run/tyql.scala b/tests/run/tyql.scala index 35777e9a4c13..8fe253b559ac 100644 --- a/tests/run/tyql.scala +++ b/tests/run/tyql.scala @@ -94,7 +94,7 @@ object Expr: extension [A <: AnyNamedTuple](x: A) def toRow: Join[A] = Join(x) /** Same as _.toRow, as an implicit conversion */ - given [A <: AnyNamedTuple]: Conversion[A, Expr.Join[A]] = Expr.Join(_) + given [A <: AnyNamedTuple] => Conversion[A, Expr.Join[A]] = Expr.Join(_) end Expr diff --git a/tests/warn/implicit-conversions.scala b/tests/warn/implicit-conversions.scala index 946d0c96fd5a..2896d7dc4447 100644 --- a/tests/warn/implicit-conversions.scala +++ b/tests/warn/implicit-conversions.scala @@ -5,11 +5,11 @@ class B object A { - given Conversion[A, B] with { + given Conversion[A, B] { def apply(x: A): B = ??? } - given Conversion[B, A] with { + given Conversion[B, A] { def apply(x: B): A = ??? } } @@ -17,7 +17,7 @@ object A { class C object D { - given Conversion[A, C] with { + given Conversion[A, C] { def apply(x: A): C = ??? } }