Skip to content

Commit 2f461f8

Browse files
committed
Update tests to use new syntax
1 parent 34afeee commit 2f461f8

File tree

147 files changed

+392
-398
lines changed

Some content is hidden

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

147 files changed

+392
-398
lines changed

tests/bench/string-interpolation-macro/Macro.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ object Macro {
99
var res: Expr[String] = null
1010
for _ <- 0 to 5_000 do
1111
(strCtxExpr, argsExpr) match {
12-
case ('{ StringContext(${Varargs(Exprs(parts))}: _*) }, Varargs(Exprs(args))) =>
13-
res = Expr(StringContext(parts: _*).s(args: _*))
12+
case ('{ StringContext(${Varargs(Exprs(parts))}*) }, Varargs(Exprs(args))) =>
13+
res = Expr(StringContext(parts*).s(args*))
1414
case _ => ???
1515
}
1616
res

tests/fuzzy/86ffb5f29d6fcab5893656be0307f2b8933b1498.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ def i1: Unit = {
33
val i2: Unit = {
44
def this(i3: Int): Unit => Unit = {
55
val i4 = 0
6-
i3(i2) = i3.i5 contains i4+ 1 else 1 + (i4: _*) * (0 i5 else i7 = + (classOf) < [Int](2)) }
6+
i3(i2) = i3.i5 contains i4+ 1 else 1 + (i4*) * (0 i5 else i7 = + (classOf) < [Int](2)) }
77
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
class I0 { List(null: _*) }
1+
class I0 { List(null*) }

tests/fuzzy/ba77fdb2a05d078e9c400f45d1fe12fa769a1c1f.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import language.List
22
class i0 {
33
def main(i1: Array[String]): Unit =
44
try {
5-
case List(_, _: _*) => 0 case List(1, 2) => i2 :: i1 - 1 }
5+
case List(_, _*) => 0 case List(1, 2) => i2 :: i1 - 1 }
66
println()
77
case _
88
(1

tests/fuzzy/ed71e8db3233023ed7a8795d01bbc03b6b063a8b.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class i0 {
22
def i1: Nothing = {
3-
def this(i2: Dynamic): Int = i2.i3(i4: _*)
3+
def this(i2: Dynamic): Int = i2.i3(i4*)
44
}
55
}
66
var i3 = 0

tests/init/crash/i6858.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
object Test extends App {
2-
inline def foo(ys: Int*): Unit = bar(ys: _*)
2+
inline def foo(ys: Int*): Unit = bar(ys*)
33
def bar(ys: Int*) = ()
44

55
val xs: Array[Int] = new Array[Int](3)
6-
foo(xs: _*)
6+
foo(xs*)
77

88
val ys: Seq[Int] = new Array[Int](3)
9-
foo(ys: _*)
9+
foo(ys*)
1010
}

tests/neg-macros/i6432/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ object Macro {
88
def impl(sc: Expr[StringContext])(using Quotes) : Expr[Unit] = {
99
import quotes.reflect._
1010
sc match {
11-
case '{ StringContext(${Varargs(parts)}: _*) } =>
11+
case '{ StringContext(${Varargs(parts)}*) } =>
1212
for (part @ Expr(s) <- parts)
1313
report.error(s, part.asTerm.pos)
1414
}

tests/neg-macros/i6432b/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ object Macro {
88
def impl(sc: Expr[StringContext])(using Quotes) : Expr[Unit] = {
99
import quotes.reflect._
1010
sc match {
11-
case '{ StringContext(${Varargs(parts)}: _*) } =>
11+
case '{ StringContext(${Varargs(parts)}*) } =>
1212
for (part @ Expr(s) <- parts)
1313
report.error(s, part.asTerm.pos)
1414
}

tests/neg-macros/i6436.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- Error: tests/neg-macros/i6436.scala:5:9 -----------------------------------------------------------------------------
2-
5 | case '{ StringContext(${Varargs(parts)}: _*) } => // error
3-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2+
5 | case '{ StringContext(${Varargs(parts)}*) } => // error
3+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44
| no implicit argument of type scala.quoted.Quotes was found
55
-- [E006] Not Found Error: tests/neg-macros/i6436.scala:6:34 -----------------------------------------------------------
66
6 | val ps: Seq[Expr[String]] = parts // error

tests/neg-macros/i6436.scala

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

33
def f(sc: quoted.Expr[StringContext]): Unit = {
44
sc match {
5-
case '{ StringContext(${Varargs(parts)}: _*) } => // error
5+
case '{ StringContext(${Varargs(parts)}*) } => // error
66
val ps: Seq[Expr[String]] = parts // error
77
}
88
}

tests/neg-macros/quote-interpolator-core-old.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ object FInterpolation {
1919
def fInterpolation(sc: StringContext, args: Seq[Expr[Any]])(using Quotes): Expr[String] = {
2020
val str: Expr[String] = Expr(sc.parts.mkString(""))
2121
val args1: Expr[Seq[Any]] = liftSeq(args)
22-
'{ $str.format($args1: _*) }
22+
'{ $str.format($args1*) }
2323
}
2424

2525
def hello = "hello"

tests/neg-macros/tasty-string-interpolator-position-a/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ object FIntepolator {
1212
def apply(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using Quotes) : Expr[String] = {
1313
import quotes.reflect._
1414
report.error("there are no parts", strCtxExpr.asTerm.underlyingArgument.pos)
15-
'{ ($strCtxExpr).s($argsExpr: _*) }
15+
'{ ($strCtxExpr).s($argsExpr*) }
1616
}
1717

1818
}

tests/neg-macros/tasty-string-interpolator-position-b/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ object FIntepolator {
1111
def apply(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using Quotes) : Expr[String] = {
1212
import quotes.reflect._
1313
report.error("there are no args", argsExpr.asTerm.underlyingArgument.pos)
14-
'{ ($strCtxExpr).s($argsExpr: _*) }
14+
'{ ($strCtxExpr).s($argsExpr*) }
1515
}
1616

1717
}

tests/neg-scalajs/reflective-calls.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ object Test {
2828
def classOfVarArgs(): Unit = {
2929
val receiver: ReflectSel = ???
3030
val classOfs: List[Class[_]] = List(classOf[String], classOf[List[_]])
31-
receiver.applyDynamic("foo", classOfs: _*)("bar", Nil) // error
31+
receiver.applyDynamic("foo", classOfs*)("bar", Nil) // error
3232
}
3333

3434
def argsVarArgs(): Unit = {
3535
val receiver: ReflectSel = ???
3636
val args: List[Any] = List("bar", Nil)
37-
receiver.applyDynamic("foo", classOf[String], classOf[List[_]])(args: _*) // error
37+
receiver.applyDynamic("foo", classOf[String], classOf[List[_]])(args*) // error
3838
}
3939
}

tests/neg/applydynamic_sip.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ object Test extends App {
55
val a = "a"
66
val a2 = "a2"
77

8-
qual.sel(a, a2: _*) // error
9-
qual.sel(arg = a, a2: _*) // error
10-
qual.sel(arg, arg2 = "a2", a2: _*) // error
8+
qual.sel(a, a2*) // error
9+
qual.sel(arg = a, a2*) // error
10+
qual.sel(arg, arg2 = "a2", a2*) // error
1111

1212
class Bad1 extends Dynamic {
1313
def selectDynamic(n: Int) = n

tests/neg/creator-ambiguous.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ object Test:
88

99
object Record:
1010

11-
inline def apply[R <: Record](elems: (String, Any)*) : R = new Record(elems: _*).asInstanceOf[R]
11+
inline def apply[R <: Record](elems: (String, Any)*) : R = new Record(elems*).asInstanceOf[R]
1212

13-
def fromUntypedTuple(elems: (String, Any)*): Record = Record(elems: _*) // error: ambiguous overload
13+
def fromUntypedTuple(elems: (String, Any)*): Record = Record(elems*) // error: ambiguous overload
1414

1515
def apply(x: String): Test = Test(x ++ x)
1616

tests/neg/i1643.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
trait T extends Array { // error // error
2-
def t1(as: String*): Array[String] = { varargs1(as: _*) } // error
3-
def t2(as: String*): Array[String] = { super.varargs1(as: _*) } // error
2+
def t1(as: String*): Array[String] = { varargs1(as*) } // error
3+
def t2(as: String*): Array[String] = { super.varargs1(as*) } // error
44
}
55
class C extends Base_1 { // error
6-
def c1(as: String*): Array[String] = { varargs1(as: _*) } // error
7-
def c2(as: String*): Array[String] = { super.varargs1(as: _*) } // error
6+
def c1(as: String*): Array[String] = { varargs1(as*) } // error
7+
def c2(as: String*): Array[String] = { super.varargs1(as*) } // error
88
}
99
object Test extends App {
1010
val t = new T {} // error

tests/neg/i4922.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ object A {
99
object Main {
1010
def main(args: Array[String]): Unit = {
1111
val seq: Seq[Int] = 2 match {
12-
case A(xs: _*) => xs // error // error
12+
case A(xs*) => xs // error // error
1313
}
1414
}
1515
}

tests/neg/i4984.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ object Array3 {
2626
object Test {
2727
def test(xs: Array[Int]): Int = xs match {
2828
case Array2(x, y) => 1 // error
29-
case Array2(x, y, xs: _*) => 2 // error
30-
case Array2(xs: _*) => 3 // error
29+
case Array2(x, y, xs*) => 2 // error
30+
case Array2(xs*) => 3 // error
3131
}
3232

3333
def test2(xs: Array[Int]): Int = xs match {
3434
case Array3(x, y) => 1 // error
35-
case Array3(x, y, xs: _*) => 2 // error
36-
case Array3(xs: _*) => 3 // error
35+
case Array3(x, y, xs*) => 2 // error
36+
case Array3(xs*) => 3 // error
3737
}
3838
}

tests/neg/i533/Test.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ object Test {
33
val x = new Array[Int](1)
44
x(0) = 10
55
println(JA.get(x)) // error
6-
println(JA.getVarargs(x: _*)) // now OK.
6+
println(JA.getVarargs(x*)) // now OK.
77
}
88
}

tests/neg/i7972.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
object O {
2-
def m1(a: Int*) = (a: _*) // error // error: Cannot return repeated parameter type Int*
3-
def m2(a: Int*) = { // error: Cannot return repeated parameter type Int*
4-
val b = (a: _*) // error // error: Cannot return repeated parameter type Int*
2+
def m1(a: Int*) = (a*) // error
3+
def m2(a: Int*) = {
4+
val b = (a*) // error
55
b
66
}
77
def m3(a: Int*): Any = {
8-
val b = (a: _*) // error // error: Cannot return repeated parameter type Int*
8+
val b = (a*) // error
99
b
1010
}
11-
def m4(a: 2*) = (a: _*) // error // error: Cannot return repeated parameter type Int*
11+
def m4(a: 2*) = (a*) // error
1212

1313
}
1414

1515
class O(a: Int*) {
16-
val m = (a: _*) // error // error: Cannot return repeated parameter type Int*
17-
}
16+
val m = (a*) // error
1817

18+
}

tests/neg/i8407.scala

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/neg/i8715.scala

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/neg/i9298.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
object Foo {
22
val foo = Nil
33
object foo // error
4-
foo(foo: _*) // error
4+
foo(foo*) // error
55
}

tests/neg/i9749.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ class A {
22
def f(x: Any) = 1
33

44
def foo(x: List[String]): Unit = {
5-
f(x: _*) // error
5+
f(x*) // error
66
}
77
}

tests/neg/repeatedArgs213.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@ class repeatedArgs {
66

77
def test(xs: immutable.Seq[String], ys: collection.Seq[String], zs: Array[String]): Unit = {
88
bar("a", "b", "c")
9-
bar(xs: _*)
10-
bar(ys: _*) // error: immutable.Seq expected, found Seq
11-
bar(zs: _*) // old-error: Remove (compiler generated) Array to Seq conversion in 2.13?
9+
bar(xs*)
10+
bar(ys*) // error: immutable.Seq expected, found Seq
11+
bar(zs*) // old-error: Remove (compiler generated) Array to Seq conversion in 2.13?
1212

1313
Paths.get("Hello", "World")
14-
Paths.get("Hello", xs: _*)
15-
Paths.get("Hello", ys: _*) // error: immutable.Seq expected, found Seq
16-
Paths.get("Hello", zs: _*)
14+
Paths.get("Hello", xs*)
15+
Paths.get("Hello", ys*) // error: immutable.Seq expected, found Seq
16+
Paths.get("Hello", zs*)
1717
}
1818

1919
def test2(xs: immutable.Seq[String] | Null, ys: collection.Seq[String] | Null, zs: Array[String] | Null): Unit = {
2020
bar("a", "b", "c")
21-
bar(xs: _*)
22-
bar(ys: _*) // error: immutable.Seq expected, found Seq
23-
bar(zs: _*) // old-error: Remove (compiler generated) Array to Seq conversion in 2.13?
21+
bar(xs*)
22+
bar(ys*) // error: immutable.Seq expected, found Seq
23+
bar(zs*) // old-error: Remove (compiler generated) Array to Seq conversion in 2.13?
2424

2525
Paths.get("Hello", "World")
26-
Paths.get("Hello", xs: _*)
27-
Paths.get("Hello", ys: _*) // error: immutable.Seq expected, found Seq
28-
Paths.get("Hello", zs: _*)
26+
Paths.get("Hello", xs*)
27+
Paths.get("Hello", ys*) // error: immutable.Seq expected, found Seq
28+
Paths.get("Hello", zs*)
2929
}
3030
}

tests/neg/t5702-neg-bad-and-wild.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ object Test {
77
val is = List(1,2,3)
88

99
is match {
10-
case List(1, _*,) => // error // // error: bad use of _* (a sequence pattern must be the last pattern)
11-
// illegal start of simple pattern
12-
case List(1, _*3,) => // error // error // error: illegal start of simple pattern
10+
case List(1, _*,) => // error: pattern expected // error
11+
12+
case List(1, _*3,) => // error: pattern expected // error // error
1313
//case List(1, _*3:) => // poor recovery by parens
1414
case List(1, x*) => // ok
1515
case List(x*, 1) => // error: pattern expected
@@ -20,8 +20,8 @@ object Test {
2020
// good syntax, bad semantics, detected by typer
2121
//gowild.scala:14: error: star patterns must correspond with varargs parameters
2222
val K(x @ _*) = k
23-
val K(ns @ _*, x) = k // error: bad use of _* (a sequence pattern must be the last pattern)
24-
val (b, _ : _* ) = (5,6) // error: bad use of _* (sequence pattern not allowed)
23+
val K(ns @ _*, x) = k // error: pattern expected
24+
val (b, _ * ) = (5,6) // ok
2525
// no longer complains
2626
//bad-and-wild.scala:15: error: ')' expected but '}' found.
2727
}

tests/patmat/i6490.scala

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

77
def foo(x: Foo): Unit =
88
x match {
9-
case Foo(x, _: _*) => assert(x == 3)
9+
case Foo(x, _*) => assert(x == 3)
1010
}

tests/patmat/i8757.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ sealed trait T
22

33
case class C(xs: Int*) extends T
44

5-
def f(): Unit = (C(42): T) match { case C(xs: _*) => }
6-
def g(): Unit = (C(42): T) match { case C(_: _*) => }
5+
def f(): Unit = (C(42): T) match { case C(xs*) => }
6+
def g(): Unit = (C(42): T) match { case C(_*) => }
77

88
def h(): Unit = (C(42): T) match
9-
case C(5, _: _*) =>
10-
case C(x, xs: _*) =>
9+
case C(5, _*) =>
10+
case C(x, xs*) =>

tests/patmat/t8178.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ case class FailsChild2(a: Seq[String]) extends Fails
44
object FailsTest {
55
def matchOnVarArgsFirstFails(f: Fails) = {
66
f match {
7-
case VarArgs1(_: _*) => ???
7+
case VarArgs1(_*) => ???
88
// BUG: Without this line we should get a non-exhaustive match compiler error.
99
//case FailsChild2(_) => ???
1010
}

tests/patmat/t9232.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ case class Node2() extends Tree
1111

1212
object Test {
1313
def transformTree(tree: Tree): Any = tree match {
14-
case Node1(Foo(_: _*)) => ???
14+
case Node1(Foo(_*)) => ???
1515
}
1616

1717
def transformTree2(tree: Tree): Any = tree match {
18-
case Node1(Foo(1, _: _*)) => ???
18+
case Node1(Foo(1, _*)) => ???
1919
}
2020

2121
def transformTree3(tree: Tree): Any = tree match {
22-
case Node1(Foo(x, _: _*)) => ???
22+
case Node1(Foo(x, _*)) => ???
2323
}
2424
}

tests/pending/run/caseClassEquality.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ object Test {
1313
}
1414

1515
case class CS1(xs: Any*)
16-
class CS2(xs: Seq[_]*) extends CS1(xs: _*)
17-
class CS3(xs: IndexedSeq[Int]*) extends CS2(xs: _*)
16+
class CS2(xs: Seq[_]*) extends CS1(xs*)
17+
class CS3(xs: IndexedSeq[Int]*) extends CS2(xs*)
1818

1919
case class H1(x: Int, y: Double)
2020
class H2(x: Double, y: Int) extends H1(y, x)

tests/pending/run/patmat-behavior-2.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ object Test {
1717
case _ => false
1818
}
1919
def f1seq(x: Any) = x match {
20-
case Foo(x, ys : _*) => true
20+
case Foo(x, ys *) => true
2121
case _ => false
2222
}
2323
def f2seq(x: Any) = x match {
24-
case Foo(x, y, zs : _*) => true
24+
case Foo(x, y, zs *) => true
2525
case _ => false
2626
}
2727
def f3seq(x: Any) = x match {
28-
case Foo(x, y, z, qs : _*) => true
28+
case Foo(x, y, z, qs *) => true
2929
case _ => false
3030
}
3131

0 commit comments

Comments
 (0)