Skip to content

Commit 3a44cf8

Browse files
committed
Update most tests to new syntax
I left some tests to use the old syntax, just so that we have early warnings for possible regressions. But most tests are now using the new syntax, so that we best reassurance that corner cases work.
1 parent 0c721dc commit 3a44cf8

File tree

239 files changed

+1135
-468
lines changed

Some content is hidden

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

239 files changed

+1135
-468
lines changed

docs/_docs/reference/contextual/sip-64.md

Lines changed: 684 additions & 0 deletions
Large diffs are not rendered by default.

tests/init/crash/i6914.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ object test1 {
55
class ToExpr[T](using Liftable[T]) extends Conversion[T, Expr[T]] {
66
def apply(x: T): Expr[T] = ???
77
}
8-
given toExprFun[T](using Liftable[T]): ToExpr[T] with {}
8+
given toExprFun: [T] => Liftable[T] => ToExpr[T]()
99

1010
given Liftable[Int] = ???
1111
given Liftable[String] = ???
@@ -16,14 +16,12 @@ object test1 {
1616
def a: Expr[String] = "abc"
1717
}
1818

19-
object test2 {
19+
object test2:
2020

21-
given autoToExpr[T](using Liftable[T]): Conversion[T, Expr[T]] with {
21+
given autoToExpr: [T] => Liftable[T] => Conversion[T, Expr[T]]:
2222
def apply(x: T): Expr[T] = ???
23-
}
2423

2524
given Liftable[Int] = ???
2625
given Liftable[String] = ???
2726

2827
def a: Expr[String] = "abc"
29-
}

tests/init/crash/i7821.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,17 @@ object XObject {
33

44
def anX: X = 5
55

6-
given ops: Object with {
6+
given ops: Object:
77
extension (x: X) def + (y: X): X = x + y
8-
}
98
}
109

1110
object MyXObject {
1211
opaque type MyX = XObject.X
1312

1413
def anX: MyX = XObject.anX
1514

16-
given ops: Object with {
15+
given ops: Object:
1716
extension (x: MyX) def + (y: MyX): MyX = x + y // error: warring: Infinite recursive call
18-
}
1917
}
2018

2119
object Main extends App {

tests/neg-macros/BigFloat/BigFloat_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ object BigFloat extends App {
3535
def fromDigits(digits: String) = apply(digits)
3636
}
3737

38-
given BigFloatFromDigits with {
38+
given BigFloatFromDigits {
3939
override inline def fromDigits(digits: String) = ${
4040
BigFloatFromDigitsImpl('digits)
4141
}
4242
}
4343

4444
// Should be in StdLib:
4545

46-
given ToExpr[BigInt] with {
46+
given ToExpr[BigInt] {
4747
def apply(x: BigInt)(using Quotes) =
4848
'{BigInt(${Expr(x.toString)})}
4949
}

tests/neg-macros/GenericNumLits/Even_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ object Even {
1616
def fromDigits(digits: String) = evenFromDigits(digits)
1717
}
1818

19-
given EvenFromDigits with {
19+
given EvenFromDigits {
2020
override transparent inline def fromDigits(digits: String) = ${
2121
EvenFromDigitsImpl('digits)
2222
}

tests/neg-macros/i11483/Test_2.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package x
33
import scala.language.implicitConversions
44
import scala.concurrent.Future
55

6-
given FutureAsyncMonad: CpsMonad[Future] with
6+
given FutureAsyncMonad: CpsMonad[Future]:
77
def pure[T](t:T): Future[T] = ???
88
def impure[T](t:Future[T]): T = ???
99
def map[A,B](x:Future[A])(f: A=>B): Future[B] = ???

tests/neg-macros/i17152/DFBits.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ trait Baz
1616
trait Width[T]:
1717
type Out <: Int
1818
object Width:
19-
given fromDFBoolOrBit[T <: DFBoolOrBit]: Width[T] with
19+
given fromDFBoolOrBit: [T <: DFBoolOrBit] => Width[T]:
2020
type Out = 1
2121
transparent inline given [T]: Width[T] = ${ getWidthMacro[T] }
2222
def getWidthMacro[T](using Quotes, Type[T]): Expr[Width[T]] =
@@ -38,7 +38,7 @@ private object CompanionsDFBits:
3838
type OutW <: Int
3939
def apply(value: R): DFValOf[DFBits[OutW]]
4040
object Candidate:
41-
given fromDFUInt[W <: Int, R <: DFValOf[DFDecimal]]: Candidate[R] with
41+
given fromDFUInt: [W <: Int, R <: DFValOf[DFDecimal]] => Candidate[R]:
4242
type OutW = W
4343
def apply(value: R): DFValOf[DFBits[W]] =
4444
import DFVal.Ops.bits

tests/neg-macros/i19601/Macro.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ object Macros {
1010
'{ () }
1111

1212
}
13-
given [A](using Type[A]): FromExpr[Assertion[A]] with {
13+
given [A] => Type[A] => FromExpr[Assertion[A]] {
1414
def unapply(assertion: Expr[Assertion[A]])(using Quotes): Option[Assertion[A]] = {
1515
import quotes.reflect.*
1616

tests/neg-macros/i7919.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ import scala.quoted.*
33
object Test {
44
def staged[T](using Quotes) = {
55
import quotes.reflect.*
6-
given typeT: Type[T] with {} // error
6+
given typeT: Type[T] {} // error
77
val tt = TypeRepr.of[T]
88
'{ "in staged" }
99
}
1010

11-
given Expr[Int] with {} // error
11+
given Expr[Int] {} // error
1212
new Expr[Int] // error
1313
class Expr2 extends Expr[Int] // error
1414

15-
given Type[Int] with {} // error
15+
given Type[Int] {} // error
1616
new Type[Int] // error
1717
class Type2 extends Type[Int] // error
1818

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ object Even {
1616
def fromDigits(digits: String) = evenFromDigits(digits)
1717
}
1818

19-
given EvenFromDigits with {
19+
given EvenFromDigits {
2020
override inline def fromDigits(digits: String) = ${
2121
EvenFromDigitsImpl('digits)
2222
}

0 commit comments

Comments
 (0)