Skip to content

Commit 4495cba

Browse files
committed
Switch tests to postfix as
1 parent fd36ef8 commit 4495cba

Some content is hidden

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

54 files changed

+97
-97
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 Set[String | Int] as namedSet = Set(1, "ala")
6969
/** doc */
70-
given namedMap as Map[String, Double] = Map.empty
70+
given Map[String, Double] as namedMap = 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 List[String] as namedList = "ula" :: Nil
120120
/** doc */
121-
protected given namedSeq as Seq[String | Int | Double] = List(1)
121+
protected given Seq[String | Int | Double] as namedSeq = List(1)
122122

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

scala3doc-testcases/src/tests/givenDRI.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ given [S <: C] as A[S]
2323
class R:
2424
def a = 1
2525

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

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

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

scala3doc-testcases/src/tests/givenSignatures.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ 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 Ord[Int] as intOrd {
1919
def compare(x: Int, y: Int) =
2020
if (x < y) -1 else if (x > y) +1 else 0
2121
}
@@ -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 Int.type as IntOps = Int
3939

4040
given GivenType = GivenType()
4141

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ object JsonEncoder {
3939
def encode(list: List[T]) = s"[${ list.map(v => encoder.encode(v)).mkString(", ") }]"
4040
}
4141

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

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

tests/disabled/pos/i8311.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Foo
99
object test:
1010

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

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

tests/init/crash/i7821.scala

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

44
def anX: X = 5
55

6-
given ops as Object {
6+
given Object as ops {
77
extension (x: X) def + (y: X): X = x + y
88
}
99
}
@@ -13,7 +13,7 @@ object MyXObject {
1313

1414
def anX: MyX = XObject.anX
1515

16-
given ops as Object {
16+
given Object as ops {
1717
extension (x: MyX) def + (y: MyX): MyX = x + y // error: warring: Infinite recursive call
1818
}
1919
}

tests/neg-custom-args/fatal-warnings/i7821.scala

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

44
def anX: X = 5
55

6-
given ops as Object {
6+
given Object as ops {
77
extension (x: X) def + (y: X): X = x + y
88
}
99
}
@@ -13,7 +13,7 @@ object MyXObject {
1313

1414
def anX: MyX = XObject.anX
1515

16-
given ops as Object {
16+
given Object as ops {
1717
extension (x: MyX) def + (y: MyX): MyX = x + y // error: warring: Infinite recursive call
1818
}
1919
}

tests/neg-custom-args/impl-conv/A.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package implConv
33
object A {
44

55
implicit def s2i(x: String): Int = Integer.parseInt(x) // error: feature
6-
given i2s as Conversion[Int, String] = _.toString // ok
6+
given Conversion[Int, String] as i2s = _.toString // ok
77

88
implicit class Foo(x: String) {
99
def foo = x.length

tests/neg-macros/i4044b.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ def test(using Quotes) = {
44

55
'{
66
val qctx: Quotes = ???
7-
given x1 as qctx.type = qctx
7+
given qctx.type as x1 = qctx
88

99
val b = '{3}
1010

1111
'{
1212
val qctx: Quotes = ???
13-
given x2 as qctx.type = qctx
13+
given qctx.type as x2 = qctx
1414

1515
b // error
1616
${b}

tests/neg/extmethod-overload.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
object Test {
2-
given a as AnyRef:
2+
given AnyRef as a:
33
extension (x: Int) {
44
def |+| (y: Int) = x + y
55
}
6-
given b as AnyRef:
6+
given AnyRef as b:
77
extension (x: Int) {
88
def |+| (y: String) = x + y.length
99
}

tests/neg/i5978.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ opaque type Position[Buffer] = Int
55
trait TokenParser[Token, R]
66

77
object TextParser {
8-
given TP as TokenParser[Char, Position[CharSequence]] {}
8+
given TokenParser[Char, Position[CharSequence]] as tp {}
99

1010
given FromCharToken(using T: TokenParser[Char, Position[CharSequence]])
1111
as Conversion[Char, Position[CharSequence]] = ???
@@ -15,13 +15,13 @@ object Testcase {
1515
def main(args: Array[String]): Unit = {
1616
import TextParser._
1717

18-
val tp_v: TokenParser[Char, Position[CharSequence]] = TextParser.TP
18+
val tp_v: TokenParser[Char, Position[CharSequence]] = TextParser.tp
1919
val tp_i = summon[TokenParser[Char, Position[CharSequence]]] // error
2020
val co_i = summon[Conversion[Char, Position[CharSequence]]] // error
2121
val co_x : Position[CharSequence] = 'x' // error
2222

2323
{
24-
given XXX as Conversion[Char, Position[CharSequence]] = co_i
24+
given Conversion[Char, Position[CharSequence]] as xxx = co_i
2525
val co_y : Position[CharSequence] = 'x'
2626
}
2727
}

tests/neg/i7078.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
trait A
22
class B extends A
33

4-
transparent given g1 as A = B() // error: `transparent` can only be used in conjunction with `inline`
4+
transparent given A as g1 = B() // error: `transparent` can only be used in conjunction with `inline`
55

66
inline given g2 as _ <: A: // error: `=' expected
77
def foo = 2

tests/neg/i7526.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ def compQ(name: => String)
1313

1414
object net extends NetDB with NetHelper
1515
import net._
16-
given n as NetApi = net
16+
given NetApi as n = net
1717

1818
val q: Tr[Nothing, Comp, Comp] = compQ("???") // error Found: Tr[Nothing, ?1.Comp, ?1.Comp] Required: Tr[Nothing, net.Comp, net.Comp]

tests/neg/i7980.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ trait Evidence[X]
33
trait Trait[X : Evidence]:
44
def method(x : X) : X
55

6-
given ev as Evidence[Int] = new Evidence[Int]{}
6+
given Evidence[Int] as ev = new Evidence[Int]{}
77
val crash : Trait[Int] = (x: Int) => x // error

tests/neg/i8623a.scala

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

99
def foo: A & B = o
10-
given o as (A & B) = foo
10+
given (A & B) as o = foo
1111

1212
def xToString(x: o.X): String = x // error
1313

tests/neg/i9185.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
trait M[F[_]] { def pure[A](x: A): F[A] }
22
object M {
33
extension [A, F[A]](x: A) def pure(using m: M[F]): F[A] = m.pure(x)
4-
given listMonad as M[List] { def pure[A](x: A): List[A] = List(x) }
5-
given optionMonad as M[Option] { def pure[A](x: A): Option[A] = Some(x) }
4+
given M[List] as listMonad { def pure[A](x: A): List[A] = List(x) }
5+
given M[Option] as optionMonad { def pure[A](x: A): Option[A] = Some(x) }
66
val value1: List[String] = "ola".pure
77
val value2 = "ola".pure // error
88
val value3 = M.pure("ola") // error

tests/neg/machine-state-encoding-with-implicit-match.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ final class Off extends State
88
@implicitNotFound("State must be Off")
99
class IsOff[S <: State]
1010
object IsOff {
11-
given isOff as IsOff[Off] = new IsOff[Off]
11+
given IsOff[Off] as isOff = new IsOff[Off]
1212
}
1313

1414
@implicitNotFound("State must be On")
1515
class IsOn[S <: State]
1616
object IsOn {
17-
given isOn as IsOn[On] = new IsOn[On]
17+
given IsOn[On] as isOn = new IsOn[On]
1818
}
1919

2020
class Machine[S <: State] {

tests/neg/missing-implicit1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ object testObjectInstance:
55
}
66

77
object instances {
8-
given zipOption as Zip[Option] = ???
9-
given traverseList as Traverse[List] = ???
8+
given Zip[Option] as zipOption = ???
9+
given Traverse[List] as traverseList = ???
1010
extension [T](xs: List[T])
1111
def second: T = xs.tail.head
1212
extension [T](xs: List[T]) def first: T = xs.head

tests/neg/missing-implicit2.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ trait Y
33
object test:
44
def f(using x: X) = ???
55
object instances {
6-
given y as Y = ???
6+
given Y as y = ???
77
}
88
locally {
99
given xFromY(using y: Y) as X = ???

tests/neg/missing-implicit4.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ def testLocalInstance =
55
}
66

77
object instances {
8-
given zipOption as Zip[Option] = ???
9-
given traverseList as Traverse[List] = ???
8+
given Zip[Option] as zipOption = ???
9+
given Traverse[List] as traverseList = ???
1010
}
1111

1212
def ff(using xs: Zip[Option]) = ???

tests/neg/missing-implicit5.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ object testObjectInstance:
55
}
66

77
object instances {
8-
given zipOption as Zip[Option] = ???
9-
given traverseList as Traverse[List] = ???
8+
given Zip[Option] as zipOption = ???
9+
given Traverse[List] as traverseList = ???
1010
extension [T](xs: List[T])
1111
def second: T = xs.tail.head
1212
extension [T](xs: List[T]) def first: T = xs.head

tests/neg/multi-param-derives.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ object Test extends App {
5656
{
5757
trait Bifunctor[F[_, _]]
5858
object Bifunctor {
59-
given [C] as Bifunctor[[T, U] =>> C] {}
59+
given [C] => Bifunctor[[T, U] =>> C] {}
6060
given Bifunctor[[T, U] =>> Tuple1[U]] {}
61-
given t2 as Bifunctor[[T, U] =>> (T, U)] {}
61+
given Bifunctor[[T, U] =>> (T, U)] as t2 {}
6262
given t3 [T] as Bifunctor[[U, V] =>> (T, U, V)] {}
6363

6464
def derived[F[_, _]](using m: Mirror { type MirroredType[X, Y] = F[X, Y] ; type MirroredElemTypes[_, _] }, r: Bifunctor[m.MirroredElemTypes]): Bifunctor[F] = ???

tests/patmat/i6088.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ enum ExprF[R[_],I] {
1717

1818
/** Companion. */
1919
object ExprF {
20-
given hfunctor as HFunctor[ExprF] {
20+
given HFunctor[ExprF] as hfunctor {
2121
def hmap[A[_], B[_]](nt: A ~> B): ([x] =>> ExprF[A,x]) ~> ([x] =>> ExprF[B,x]) = {
2222
new ~>[[x] =>> ExprF[A,x], [x] =>> ExprF[B,x]] {
2323
def apply[I](fa: ExprF[A,I]): ExprF[B,I] = fa match {

tests/pos-custom-args/erased/i7878.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ object Boom {
99
}
1010

1111
val a: Int = 1
12-
given ev1 as Fail[a.type, 2] = null
12+
given Fail[a.type, 2] as ev1 = null
1313

1414
summon[Fail[a.type, 3]]
1515
}

tests/pos-macros/i6803b/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ object AsObject {
77
final class LineNo(val lineNo: Int)
88
object LineNo {
99
def unsafe(i: Int): LineNo = new LineNo(i)
10-
inline given x as LineNo = ${impl}
10+
inline given LineNo as x = ${impl}
1111
private def impl(using Quotes) : Expr[LineNo] = {
1212
import quotes.reflect._
1313
'{unsafe(${Expr(Position.ofMacroExpansion.startLine)})}

tests/pos-macros/nil-liftable.scala

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

33
class Test:
4-
given NilIsLiftable as Liftable[Nil.type] = new Liftable[Nil.type] {
4+
given Liftable[Nil.type] as nilIsLiftable = new Liftable[Nil.type] {
55
def toExpr(xs: Nil.type): Quotes ?=> Expr[Nil.type] =
66
'{ Nil }
77
}

tests/pos/i5966.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
object Test {
22
def foo = (v: Int) ?=> (x: Int) => v + x
3-
given myInt as Int = 4
3+
given Int as myInt = 4
44

55
foo.apply(1)
66
foo(using 2)

tests/pos/i5978.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ trait TokenParser[Token, R]
77
package p1 {
88

99
object TextParser {
10-
given TP as TokenParser[Char, Position[CharSequence]] {}
10+
given TokenParser[Char, Position[CharSequence]] as tp {}
1111

1212
def f
1313
(using TokenParser[Char, Position[CharSequence]]) = ???
@@ -23,13 +23,13 @@ package p1 {
2323
def main(args: Array[String]): Unit = {
2424
import TextParser.{given, _}
2525

26-
val tp_v: TokenParser[Char, Position[CharSequence]] = TextParser.TP
26+
val tp_v: TokenParser[Char, Position[CharSequence]] = TextParser.tp
2727
val tp_i = summon[TokenParser[Char, Position[CharSequence]]]
2828
val co_i = summon[Conversion[Char, Position[CharSequence]]]
2929
val co_x : Position[CharSequence] = 'x'
3030

3131
{
32-
given XXX as Conversion[Char, Position[CharSequence]] = co_i
32+
given Conversion[Char, Position[CharSequence]] as xxx = co_i
3333
val co_y : Position[CharSequence] = 'x'
3434
}
3535
}
@@ -74,7 +74,7 @@ package p3 {
7474
val co_x : Position[CharSequence] = 'x'
7575

7676
{
77-
given XXX as Conversion[Char, Position[CharSequence]] = co_i
77+
given Conversion[Char, Position[CharSequence]] as xxx = co_i
7878
val co_y : Position[CharSequence] = 'x'
7979
}
8080
}
@@ -84,7 +84,7 @@ package p3 {
8484
package p4 {
8585
class TC
8686

87-
given a as TC
87+
given TC as a
8888

8989
given b[X[_], Y] as TC
9090

tests/pos/i6373.scala

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

77
inline def f(): Contextual[Boolean] = summon[Context].t
88

9-
given ctx as Context = new Context(true)
9+
given Context as ctx = new Context(true)
1010

1111
f()
1212
}

tests/pos/i7078.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
trait A
22
class B extends A
33

4-
transparent inline given tc as A = B()
4+
transparent inline given A as tc = B()
55

66
val x: B = summon[A]
77

0 commit comments

Comments
 (0)