Skip to content

Commit 82e7c4e

Browse files
committed
Change tests to new syntax
1 parent 5feebea commit 82e7c4e

File tree

125 files changed

+375
-375
lines changed

Some content is hidden

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

125 files changed

+375
-375
lines changed

scala3doc-testcases/src/tests/FilterTest.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ class FilterTestBase:
6565
given Map[String, Double] = Map.empty
6666

6767
/** doc */
68-
protected given namedSet as Set[String | Int] = Set(1, "ala")
68+
protected given namedSet: Set[String | Int] = Set(1, "ala")
6969
/** doc */
70-
given namedMap as Map[String, Double] = Map.empty
70+
given namedMap: Map[String, Double] = Map.empty
7171

7272
class FilterTest extends FilterTestBase with FilterTestBaseTrait:
7373
/** doc */
@@ -116,9 +116,9 @@ class FilterTest extends FilterTestBase with FilterTestBaseTrait:
116116
given List[String] = "ula" :: Nil
117117

118118
/** doc */
119-
given namedList as List[String] = "ula" :: Nil
119+
given namedList: List[String] = "ula" :: Nil
120120
/** doc */
121-
protected given namedSeq as Seq[String | Int | Double] = List(1)
121+
protected given namedSeq: Seq[String | Int | Double] = List(1)
122122

123123
extension (e: FilterTest):
124124
def extensionMethod(name: FilterTest): FilterTest = ???

scala3doc-testcases/src/tests/givenDRI.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ given A[String]
1010

1111
given A[Seq[String]]
1212

13-
given [T: A] as A[Option[T]]
13+
given [T: A]: A[Option[T]] with {}
1414

15-
given [T: B] as A[T]
15+
given [T: B]: A[T] with {}
1616

17-
given [C] as A[C]
17+
given [C]: A[C] with {}
1818

1919
given A[C]
2020

21-
given [S <: C] as A[S]
21+
given [S <: C]: A[S] with {}
2222

2323
class R:
2424
def a = 1
2525

26-
given R as A[Int]:
26+
given R: A[Int] with
2727
def a = 2
2828

2929
class S:
3030
class R:
3131
def a = 3
3232

33-
given R as A[Int]:
33+
given R: A[Int] with
3434
def a = 5

scala3doc-testcases/src/tests/givenSignatures.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ class GivenClass {
1515
extension (x: T) def < (y: T) = compare(x, y) < 0
1616
extension (x: T) def > (y: T) = compare(x, y) > 0
1717
}
18-
given intOrd as Ord[Int] {
18+
given intOrd: Ord[Int] with {
1919
def compare(x: Int, y: Int) =
2020
if (x < y) -1 else if (x > y) +1 else 0
2121
}
2222

23-
given asd(using int: Int) as B
23+
given asd(using int: Int): B with {}
2424

25-
given asd2[T] as C[T]
25+
given asd2[T]: C[T] with {}
2626

27-
given listOrd[T](using ord: Ord[T]) as Ord[List[T]] {
27+
given listOrd[T](using ord: Ord[T]): Ord[List[T]] with {
2828

2929
def compare(xs: List[T], ys: List[T]): Int = (xs, ys) match
3030
case (Nil, Nil) => 0
@@ -35,7 +35,7 @@ class GivenClass {
3535
if (fst != 0) fst else compare(xs1, ys1)
3636
}
3737

38-
given IntOps as Int.type = Int
38+
given IntOps: Int.type = Int
3939

4040
given GivenType = GivenType()
4141

scala3doc-testcases/src/tests/implicitConversions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package tests
22

33
package implicitConversions
44

5-
given Conversion[A, B] {
5+
given Conversion[A, B] with {
66
def apply(a: A): B = ???
77
}
88

scala3doc-testcases/src/tests/implicitConversions2.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class OuterClass //unexpected
2929
= ???
3030
}
3131

32-
given conversionFromVal as Conversion[ClassWithConversionFromVal, Methods] //unexpected
32+
given conversionFromVal: Conversion[ClassWithConversionFromVal, Methods] with //unexpected
3333
{
3434
def apply(a: ClassWithConversionFromVal): Methods //unexpected
3535
= ???

scala3doc-testcases/src/tests/shadowingDRI.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ class S:
77
class R:
88
def findThisDeclaration = 1
99

10-
given R as A[B]
10+
given R: A[B] with {}

tests/disabled/pos-macros/i7853/JsonEncoder_1.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ object JsonEncoder {
3535
}
3636
}
3737

38-
given listEncoder[T](using encoder: JsonEncoder[T]) as JsonEncoder[List[T]] {
38+
given listEncoder[T](using encoder: JsonEncoder[T]): JsonEncoder[List[T]] with {
3939
def encode(list: List[T]) = s"[${ list.map(v => encoder.encode(v)).mkString(", ") }]"
4040
}
4141

42-
given intEncoder as JsonEncoder[Int] {
42+
given intEncoder: JsonEncoder[Int] with {
4343
def encode(value: Int) = value + ""
4444
}
4545

46-
given stringEncoder as JsonEncoder[String] {
46+
given stringEncoder: JsonEncoder[String] with {
4747
def encode(value: String) = value
4848
}
4949
}

tests/disabled/pos/i7851.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
trait Wrappable[T] { }
2-
given Wrappable[Float] { }
2+
given Wrappable[Float] with { }
33

44
case class Wrapped[T: Wrappable](value: T)
55

66
trait Wrapper[T] { type WrappedT }
77
object Wrapper { type Aux[T <: Tuple, WrappedT0 <: Tuple] = Wrapper[T] { type WrappedT = WrappedT0 } }
88

9-
given Wrapper[EmptyTuple] { type WrappedT = EmptyTuple }
9+
given Wrapper[EmptyTuple] with { type WrappedT = EmptyTuple }
1010

11-
given [T: Wrappable] as Wrapper[T] { type WrappedT = Wrapped[T] }
11+
given [T: Wrappable]: Wrapper[T] with with { type WrappedT = Wrapped[T] }
1212

1313
given [H: Wrappable, T <: Tuple, WrappedT0 <: Tuple]
1414
(using Wrapper.Aux[T, WrappedT0])

tests/disabled/pos/i8311.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ class Foo
88

99
object test:
1010

11-
given box[A](using Show[A]) as Show[Box[A]] = _.toString
12-
given foo as Show[Foo] = _.toString
11+
given box[A](using Show[A]): Show[Box[A]] = _.toString
12+
given foo: Show[Foo] = _.toString
1313

1414
def run(s: Box[Box[Foo]]): Unit =
1515
val x = summon[Show[Box[Box[Foo]]]]

tests/init/crash/i6914.scala

Lines changed: 2 additions & 2 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]) as ToExpr[T]
8+
given toExprFun[T](using Liftable[T]): ToExpr[T] with {}
99

1010
given Liftable[Int] = ???
1111
given Liftable[String] = ???
@@ -18,7 +18,7 @@ object test1 {
1818

1919
object test2 {
2020

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

0 commit comments

Comments
 (0)