diff --git a/compiler/src/dotty/tools/backend/jvm/BCodeBodyBuilder.scala b/compiler/src/dotty/tools/backend/jvm/BCodeBodyBuilder.scala index 8aa79f4ee6da..3e9bbce2c0ae 100644 --- a/compiler/src/dotty/tools/backend/jvm/BCodeBodyBuilder.scala +++ b/compiler/src/dotty/tools/backend/jvm/BCodeBodyBuilder.scala @@ -1825,7 +1825,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder { else jliLambdaMetaFactoryMetafactoryHandle - bc.jmethod.visitInvokeDynamicInsn(methodName, desc, metafactory, bsmArgs: _*) + bc.jmethod.visitInvokeDynamicInsn(methodName, desc, metafactory, bsmArgs*) generatedType } diff --git a/compiler/src/dotty/tools/backend/jvm/BCodeIdiomatic.scala b/compiler/src/dotty/tools/backend/jvm/BCodeIdiomatic.scala index 42f8ef7f4ef6..efd1ab19764d 100644 --- a/compiler/src/dotty/tools/backend/jvm/BCodeIdiomatic.scala +++ b/compiler/src/dotty/tools/backend/jvm/BCodeIdiomatic.scala @@ -247,9 +247,9 @@ trait BCodeIdiomatic { ): Unit = { jmethod.visitInvokeDynamicInsn( "makeConcatWithConstants", - asm.Type.getMethodDescriptor(StringRef.toASMType, argTypes:_*), + asm.Type.getMethodDescriptor(StringRef.toASMType, argTypes*), coreBTypes.jliStringConcatFactoryMakeConcatWithConstantsHandle, - (recipe +: constants):_* + (recipe +: constants)* ) } @@ -522,7 +522,7 @@ trait BCodeIdiomatic { i += 1 } assert(oldPos == keys.length, "emitSWITCH") - jmethod.visitTableSwitchInsn(keyMin, keyMax, defaultBranch, newBranches: _*) + jmethod.visitTableSwitchInsn(keyMin, keyMax, defaultBranch, newBranches*) } else { jmethod.visitLookupSwitchInsn(defaultBranch, keys, branches) } diff --git a/compiler/src/dotty/tools/backend/jvm/BackendUtils.scala b/compiler/src/dotty/tools/backend/jvm/BackendUtils.scala index 668dedd6076e..840c58cb2314 100644 --- a/compiler/src/dotty/tools/backend/jvm/BackendUtils.scala +++ b/compiler/src/dotty/tools/backend/jvm/BackendUtils.scala @@ -107,7 +107,7 @@ class BackendUtils(val postProcessor: PostProcessor) { val mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC + ACC_SYNTHETIC, "$deserializeLambda$", serializedLamdaObjDesc, null, null) def emitLambdaDeserializeIndy(targetMethods: Seq[Handle]): Unit = { mv.visitVarInsn(ALOAD, 0) - mv.visitInvokeDynamicInsn("lambdaDeserialize", serializedLamdaObjDesc, jliLambdaDeserializeBootstrapHandle, targetMethods: _*) + mv.visitInvokeDynamicInsn("lambdaDeserialize", serializedLamdaObjDesc, jliLambdaDeserializeBootstrapHandle, targetMethods*) } val targetMethodGroupLimit = 255 - 1 - 3 // JVM limit. See See MAX_MH_ARITY in CallSite.java diff --git a/compiler/src/dotty/tools/backend/jvm/ClassfileWriters.scala b/compiler/src/dotty/tools/backend/jvm/ClassfileWriters.scala index 109fac06d63a..50b5d0e122e9 100644 --- a/compiler/src/dotty/tools/backend/jvm/ClassfileWriters.scala +++ b/compiler/src/dotty/tools/backend/jvm/ClassfileWriters.scala @@ -201,7 +201,7 @@ class ClassfileWriters(frontendAccess: PostProcessorFrontendAccess) { val parent = filePath.getParent if (!builtPaths.containsKey(parent)) { parent.iterator.forEachRemaining(checkName) - try Files.createDirectories(parent, noAttributes: _*) + try Files.createDirectories(parent, noAttributes*) catch { case e: FileAlreadyExistsException => // `createDirectories` reports this exception if `parent` is an existing symlink to a directory diff --git a/compiler/src/dotty/tools/backend/jvm/CoreBTypes.scala b/compiler/src/dotty/tools/backend/jvm/CoreBTypes.scala index 538c288b5ef6..070de4b1b0e2 100644 --- a/compiler/src/dotty/tools/backend/jvm/CoreBTypes.scala +++ b/compiler/src/dotty/tools/backend/jvm/CoreBTypes.scala @@ -233,7 +233,7 @@ abstract class CoreBTypesFromSymbols[I <: DottyBackendInterface] extends CoreBTy (List(LARRAY_LENGTH, LARRAY_GET, LARRAY_SET) map (_ -> LONG)) ++ (List(FARRAY_LENGTH, FARRAY_GET, FARRAY_SET) map (_ -> FLOAT)) ++ (List(DARRAY_LENGTH, DARRAY_GET, DARRAY_SET) map (_ -> DOUBLE)) ++ - (List(OARRAY_LENGTH, OARRAY_GET, OARRAY_SET) map (_ -> ObjectRef)) : _* + (List(OARRAY_LENGTH, OARRAY_GET, OARRAY_SET) map (_ -> ObjectRef)) * ) } } diff --git a/compiler/src/dotty/tools/dotc/classpath/AggregateClassPath.scala b/compiler/src/dotty/tools/dotc/classpath/AggregateClassPath.scala index 51b261583feb..5fbe7212a674 100644 --- a/compiler/src/dotty/tools/dotc/classpath/AggregateClassPath.scala +++ b/compiler/src/dotty/tools/dotc/classpath/AggregateClassPath.scala @@ -56,7 +56,7 @@ case class AggregateClassPath(aggregates: Seq[ClassPath]) extends ClassPath { override def asClassPathStrings: Seq[String] = aggregates.map(_.asClassPathString).distinct - override def asSourcePathString: String = ClassPath.join(aggregates map (_.asSourcePathString): _*) + override def asSourcePathString: String = ClassPath.join(aggregates map (_.asSourcePathString)*) override private[dotty] def packages(inPackage: PackageName): Seq[PackageEntry] = { val aggregatedPackages = aggregates.flatMap(_.packages(inPackage)).distinct diff --git a/compiler/src/dotty/tools/dotc/config/Feature.scala b/compiler/src/dotty/tools/dotc/config/Feature.scala index f1443ad56442..9492f02abbf1 100644 --- a/compiler/src/dotty/tools/dotc/config/Feature.scala +++ b/compiler/src/dotty/tools/dotc/config/Feature.scala @@ -26,6 +26,7 @@ object Feature: val dependent = experimental("dependent") val erasedDefinitions = experimental("erasedDefinitions") val symbolLiterals = deprecated("symbolLiterals") + val ascriptionVarargsUnpacking = deprecated("ascriptionVarargsUnpacking") val fewerBraces = experimental("fewerBraces") val saferExceptions = experimental("saferExceptions") val clauseInterleaving = experimental("clauseInterleaving") diff --git a/compiler/src/dotty/tools/dotc/config/Settings.scala b/compiler/src/dotty/tools/dotc/config/Settings.scala index d992f5bdf2ee..5199c6727b41 100644 --- a/compiler/src/dotty/tools/dotc/config/Settings.scala +++ b/compiler/src/dotty/tools/dotc/config/Settings.scala @@ -24,7 +24,7 @@ object Settings: val OutputTag: ClassTag[AbstractFile] = ClassTag(classOf[AbstractFile]) class SettingsState(initialValues: Seq[Any]): - private val values = ArrayBuffer(initialValues: _*) + private val values = ArrayBuffer(initialValues*) private var _wasRead: Boolean = false override def toString: String = s"SettingsState(values: ${values.toList})" diff --git a/compiler/src/dotty/tools/dotc/core/Contexts.scala b/compiler/src/dotty/tools/dotc/core/Contexts.scala index a2adc0058938..907f62ad927d 100644 --- a/compiler/src/dotty/tools/dotc/core/Contexts.scala +++ b/compiler/src/dotty/tools/dotc/core/Contexts.scala @@ -414,7 +414,7 @@ object Contexts { * from constructor parameters to class parameter accessors. */ def superCallContext: Context = { - val locals = newScopeWith(owner.typeParams ++ owner.asClass.paramAccessors: _*) + val locals = newScopeWith(owner.typeParams ++ owner.asClass.paramAccessors*) superOrThisCallContext(owner.primaryConstructor, locals) } diff --git a/compiler/src/dotty/tools/dotc/core/Flags.scala b/compiler/src/dotty/tools/dotc/core/Flags.scala index fa57c503d61b..47b5c9f17af2 100644 --- a/compiler/src/dotty/tools/dotc/core/Flags.scala +++ b/compiler/src/dotty/tools/dotc/core/Flags.scala @@ -188,7 +188,7 @@ object Flags { flag } - def commonFlags(flagss: FlagSet*): FlagSet = union(flagss.map(_.toCommonFlags): _*) + def commonFlags(flagss: FlagSet*): FlagSet = union(flagss.map(_.toCommonFlags)*) /** The empty flag set */ val EmptyFlags: FlagSet = FlagSet(0) diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index eb878b430183..5c9ec1da3498 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -5956,7 +5956,7 @@ object Types { val elems = scope.toList val elems1 = mapOver(elems) if (elems1 eq elems) scope - else newScopeWith(elems1: _*) + else newScopeWith(elems1*) } def mapOver(tree: Tree): Tree = treeTypeMap(tree) diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index 48653ad96197..3bb9205a334c 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -2339,12 +2339,13 @@ object Parsers { val isVarargSplice = location.inArgs && followingIsVararg() in.nextToken() if isVarargSplice then - report.errorOrMigrationWarning( - em"The syntax `x: _*` is no longer supported for vararg splices; use `x*` instead${rewriteNotice(`future-migration`)}", - in.sourcePos(uscoreStart), - future) - if sourceVersion == `future-migration` then - patch(source, Span(t.span.end, in.lastOffset), " *") + if !in.featureEnabled(Feature.ascriptionVarargsUnpacking) then + report.errorOrMigrationWarning( + em"The syntax `x: _*` is no longer supported for vararg splices; use `x*` instead${rewriteNotice(`3.4-migration`)}", + in.sourcePos(uscoreStart), + `3.4`) + if sourceVersion == `3.4-migration` then + patch(source, Span(t.span.end, in.lastOffset), "*") else if opStack.nonEmpty then report.errorOrMigrationWarning( em"""`_*` can be used only for last argument of method application. diff --git a/compiler/src/dotty/tools/dotc/parsing/Tokens.scala b/compiler/src/dotty/tools/dotc/parsing/Tokens.scala index 8a20009f1927..eea68594b08d 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Tokens.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Tokens.scala @@ -14,7 +14,7 @@ abstract class TokensCommon { type Token = Int type TokenSet = BitSet - def tokenRange(lo: Int, hi: Int): TokenSet = BitSet(lo to hi: _*) + def tokenRange(lo: Int, hi: Int): TokenSet = BitSet(lo to hi *) val tokenString, debugString: Array[String] = new Array[String](maxToken + 1) diff --git a/compiler/src/dotty/tools/dotc/parsing/xml/SymbolicXMLBuilder.scala b/compiler/src/dotty/tools/dotc/parsing/xml/SymbolicXMLBuilder.scala index 0e70cc077fa4..43521b4a6305 100644 --- a/compiler/src/dotty/tools/dotc/parsing/xml/SymbolicXMLBuilder.scala +++ b/compiler/src/dotty/tools/dotc/parsing/xml/SymbolicXMLBuilder.scala @@ -66,7 +66,7 @@ class SymbolicXMLBuilder(parser: Parser, preserveWS: Boolean)(using Context) { import xmlterms.{_Null, __Elem, __Text, _buf, _md, _plus, _scope, _tmpscope, _xml} // convenience methods - private def LL[A](x: A*): List[List[A]] = List(List(x:_*)) + private def LL[A](x: A*): List[List[A]] = List(x.toList) private def const(x: Any) = Literal(Constant(x)) private def wild = Ident(nme.WILDCARD) private def wildStar = Ident(tpnme.WILDCARD_STAR) @@ -220,7 +220,7 @@ class SymbolicXMLBuilder(parser: Parser, preserveWS: Boolean)(using Context) { if (pre == null) (_scala_xml_UnprefixedAttribute, baseArgs) else (_scala_xml_PrefixedAttribute , const(pre) :: baseArgs) - Assign(Ident(_md), New(clazz, LL(attrArgs: _*))) + Assign(Ident(_md), New(clazz, LL(attrArgs*))) } def handlePrefixedAttribute(pre: String, key: String, value: Tree) = mkAttributeTree(pre, key, value) diff --git a/compiler/src/dotty/tools/dotc/printing/Formatting.scala b/compiler/src/dotty/tools/dotc/printing/Formatting.scala index 3f32b29654c9..c0be888955e9 100644 --- a/compiler/src/dotty/tools/dotc/printing/Formatting.scala +++ b/compiler/src/dotty/tools/dotc/printing/Formatting.scala @@ -144,7 +144,7 @@ object Formatting { case Nil => ("", Nil) } val (args1, suffixes1) = args.lazyZip(suffixes).map(treatArg(_, _)).unzip - new StringContext(prefix :: suffixes1.toList: _*).s(args1: _*) + new StringContext(prefix :: suffixes1.toList*).s(args1*) } } diff --git a/compiler/src/dotty/tools/dotc/quoted/Interpreter.scala b/compiler/src/dotty/tools/dotc/quoted/Interpreter.scala index dbf4fe91a970..ef1ab91e3e2a 100644 --- a/compiler/src/dotty/tools/dotc/quoted/Interpreter.scala +++ b/compiler/src/dotty/tools/dotc/quoted/Interpreter.scala @@ -171,7 +171,7 @@ class Interpreter(pos: SrcPos, classLoader0: ClassLoader)(using Context): val clazz = inst.getClass val name = fn.name.asTermName val method = getMethod(clazz, name, paramsSig(fn)) - stopIfRuntimeException(method.invoke(inst, args: _*), method) + stopIfRuntimeException(method.invoke(inst, args*), method) } private def interpretedStaticFieldAccess(sym: Symbol): Object = { @@ -186,8 +186,8 @@ class Interpreter(pos: SrcPos, classLoader0: ClassLoader)(using Context): private def interpretNew(fn: Symbol, args: List[Object]): Object = { val className = fn.owner.fullName.mangledString.replaceAll("\\$\\.", "\\$") val clazz = loadClass(className) - val constr = clazz.getConstructor(paramsSig(fn): _*) - constr.newInstance(args: _*).asInstanceOf[Object] + val constr = clazz.getConstructor(paramsSig(fn)*) + constr.newInstance(args*).asInstanceOf[Object] } private def unexpectedTree(tree: Tree): Object = @@ -218,7 +218,7 @@ class Interpreter(pos: SrcPos, classLoader0: ClassLoader)(using Context): private def getMethod(clazz: Class[?], name: Name, paramClasses: List[Class[?]]): JLRMethod = - try clazz.getMethod(name.toString, paramClasses: _*) + try clazz.getMethod(name.toString, paramClasses*) catch { case _: NoSuchMethodException => val msg = em"Could not find method ${clazz.getCanonicalName}.$name with parameters ($paramClasses%, %)" diff --git a/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala b/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala index 6398fe613b12..a1b43e463316 100644 --- a/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala +++ b/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala @@ -566,7 +566,7 @@ private class ExtractAPICollector(using Context) extends ThunkHolder { case ExprType(resultType) => withMarker(apiType(resultType), byNameMarker) case MatchType(bound, scrut, cases) => - val s = combineApiTypes(apiType(bound) :: apiType(scrut) :: cases.map(apiType): _*) + val s = combineApiTypes(apiType(bound) :: apiType(scrut) :: cases.map(apiType)*) withMarker(s, matchMarker) case ConstantType(constant) => api.Constant.of(apiType(constant.tpe), constant.stringValue) diff --git a/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala b/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala index 88c09eb4a521..7b5a80bc7b42 100644 --- a/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala +++ b/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala @@ -149,7 +149,7 @@ object SpaceEngine { if (spaces.lengthCompare(1) <= 0 || spaces.lengthCompare(10) >= 0) spaces else { val res = spaces.map(sp => (sp, spaces.filter(_ ne sp))).find { - case (sp, sps) => isSubspace(sp, Or(LazyList(sps: _*))) + case (sp, sps) => isSubspace(sp, Or(LazyList(sps*))) } if (res.isEmpty) spaces else res.get._2 @@ -158,7 +158,7 @@ object SpaceEngine { /** Flatten space to get rid of `Or` for pretty print */ def flatten(space: Space)(using Context): Seq[Space] = space match { case Prod(tp, fun, spaces) => - val ss = LazyList(spaces: _*).map(flatten) + val ss = LazyList(spaces*).map(flatten) ss.foldLeft(LazyList(Nil : List[Space])) { (acc, flat) => for { sps <- acc; s <- flat } @@ -168,7 +168,7 @@ object SpaceEngine { } case Or(spaces) => - LazyList(spaces: _*).flatMap(flatten) + LazyList(spaces*).flatMap(flatten) case _ => List(space) @@ -272,7 +272,7 @@ object SpaceEngine { else if cache.forall(sub => isSubspace(sub.nn, Empty)) then Empty else // `(_, _, _) - (Some, None, _)` becomes `(None, _, _) | (_, Some, _) | (_, _, Empty)` - val spaces = LazyList(range: _*).flatMap { i => + val spaces = LazyList(range*).flatMap { i => flatten(sub(i)).map(s => Prod(tp1, fun1, ss1.updated(i, s))) } Or(spaces) @@ -483,7 +483,7 @@ object SpaceEngine { case _ => tp }) - /** Space of the pattern: unapplySeq(a, b, c: _*) + /** Space of the pattern: unapplySeq(a, b, c*) */ def projectSeq(pats: List[Tree])(using Context): Space = { if (pats.isEmpty) return Typ(defn.NilType, false) diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index 44d8077e44db..ff9d45c7bafd 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -1297,7 +1297,7 @@ class Namer { typer: Typer => .foreach(addForwarder(name, _, span)) // ignore if any are not added def addWildcardForwarders(seen: List[TermName], span: Span): Unit = - val nonContextual = mutable.HashSet(seen: _*) + val nonContextual = mutable.HashSet(seen*) val fromCaseClass = pathType.widen.classSymbols.exists(_.is(Case)) def isCaseClassSynthesized(mbr: Symbol) = fromCaseClass && defn.caseClassSynthesized.contains(mbr) diff --git a/compiler/src/dotty/tools/io/ClassPath.scala b/compiler/src/dotty/tools/io/ClassPath.scala index b45de57f9850..ae4b9c63b528 100644 --- a/compiler/src/dotty/tools/io/ClassPath.scala +++ b/compiler/src/dotty/tools/io/ClassPath.scala @@ -94,7 +94,7 @@ trait ClassPath { /** The whole classpath in the form of one String. */ - def asClassPathString: String = ClassPath.join(asClassPathStrings: _*) + def asClassPathString: String = ClassPath.join(asClassPathStrings*) // for compatibility purposes @deprecated("use asClassPathString instead of this one", "2.11.5") def asClasspathString: String = asClassPathString @@ -152,7 +152,7 @@ object ClassPath { def join(paths: String*): String = paths.filterNot(_ == "").mkString(pathSeparator) /** Split the classpath, apply a transformation function, and reassemble it. */ - def map(cp: String, f: String => String): String = join(split(cp) map f: _*) + def map(cp: String, f: String => String): String = join(split(cp) map f*) /** Expand path and possibly expanding stars */ def expandPath(path: String, expandStar: Boolean = true): List[String] = diff --git a/compiler/src/dotty/tools/io/Jar.scala b/compiler/src/dotty/tools/io/Jar.scala index 9979a9ca9379..667dbd5965f8 100644 --- a/compiler/src/dotty/tools/io/Jar.scala +++ b/compiler/src/dotty/tools/io/Jar.scala @@ -62,7 +62,7 @@ class Jar(file: File) { finally in.close() } def jarWriter(mainAttrs: (Attributes.Name, String)*): JarWriter = { - new JarWriter(file, Jar.WManifest.apply(mainAttrs: _*).underlying) + new JarWriter(file, Jar.WManifest.apply(mainAttrs*).underlying) } def toList: List[JarEntry] = withJarInput { in => diff --git a/compiler/src/dotty/tools/runner/ScalaClassLoader.scala b/compiler/src/dotty/tools/runner/ScalaClassLoader.scala index 9ec0199abcbb..2c0976fac1ac 100644 --- a/compiler/src/dotty/tools/runner/ScalaClassLoader.scala +++ b/compiler/src/dotty/tools/runner/ScalaClassLoader.scala @@ -33,7 +33,7 @@ final class RichClassLoader(private val self: ClassLoader) extends AnyVal { val method = clsToRun.getMethod("main", classOf[Array[String]]) if !Modifier.isStatic(method.getModifiers) then throw new NoSuchMethodException(s"$objectName.main is not static") - try asContext(method.invoke(null, Array(arguments.toArray: AnyRef): _*)) + try asContext(method.invoke(null, Array(arguments.toArray: AnyRef)*)) catch unwrapHandler({ case ex => throw ex }) } diff --git a/compiler/src/dotty/tools/scripting/Main.scala b/compiler/src/dotty/tools/scripting/Main.scala index 8db12f400c64..0b954cb79b26 100755 --- a/compiler/src/dotty/tools/scripting/Main.scala +++ b/compiler/src/dotty/tools/scripting/Main.scala @@ -73,7 +73,7 @@ object Main: ) import dotty.tools.io.{Jar, Directory} val jar = new Jar(jarPath) - val writer = jar.jarWriter(manifestAttributes:_*) + val writer = jar.jarWriter(manifestAttributes*) try writer.writeAllFrom(Directory(outDir)) finally diff --git a/compiler/test-resources/repl/i3966 b/compiler/test-resources/repl/i3966 index 204a7685f854..44f42e75aecb 100644 --- a/compiler/test-resources/repl/i3966 +++ b/compiler/test-resources/repl/i3966 @@ -1,2 +1,2 @@ -scala> val List(x: _*) = List(1, 2): @unchecked +scala> val List(x*) = List(1, 2): @unchecked val x: Seq[Int] = List(1, 2) diff --git a/compiler/test/dotty/tools/CheckTypesTests.scala b/compiler/test/dotty/tools/CheckTypesTests.scala index df4bc1636d82..290d8523df49 100644 --- a/compiler/test/dotty/tools/CheckTypesTests.scala +++ b/compiler/test/dotty/tools/CheckTypesTests.scala @@ -24,7 +24,7 @@ class CheckTypeTest extends DottyTest { "List[B]" ) - checkTypes(source, types: _*) { + checkTypes(source, types*) { case (List(a, b, lu, li, lr, ls, la, lb), context) => given Context = context diff --git a/compiler/test/dotty/tools/backend/jvm/ArrayApplyOptTest.scala b/compiler/test/dotty/tools/backend/jvm/ArrayApplyOptTest.scala index e7cd20ba98b2..c55398c13cd1 100644 --- a/compiler/test/dotty/tools/backend/jvm/ArrayApplyOptTest.scala +++ b/compiler/test/dotty/tools/backend/jvm/ArrayApplyOptTest.scala @@ -109,7 +109,7 @@ class ArrayApplyOptTest extends DottyBytecodeTest { @Test def testArrayInlined = test( """{ - | inline def array(inline xs: Int*): Array[Int] = Array(xs: _*) + | inline def array(inline xs: Int*): Array[Int] = Array(xs*) | array(1, 2) |}""".stripMargin, newArray2Opcodes(T_INT, List(Op(DUP), Op(ICONST_0), Op(ICONST_1), Op(IASTORE), Op(DUP), Op(ICONST_1), Op(ICONST_2), Op(IASTORE), TypeOp(CHECKCAST, "[I"))) @@ -117,7 +117,7 @@ class ArrayApplyOptTest extends DottyBytecodeTest { @Test def testArrayInlined2 = test( """{ - | inline def array(inline x: Int, inline xs: Int*): Array[Int] = Array(x, xs: _*) + | inline def array(inline x: Int, inline xs: Int*): Array[Int] = Array(x, xs*) | array(1, 2) |}""".stripMargin, newArray2Opcodes(T_INT, List(Op(DUP), Op(ICONST_0), Op(ICONST_1), Op(IASTORE), Op(DUP), Op(ICONST_1), Op(ICONST_2), Op(IASTORE))) @@ -125,7 +125,7 @@ class ArrayApplyOptTest extends DottyBytecodeTest { @Test def testArrayInlined3 = test( """{ - | inline def array[T](inline xs: T*)(using inline ct: scala.reflect.ClassTag[T]): Array[T] = Array(xs: _*) + | inline def array[T](inline xs: T*)(using inline ct: scala.reflect.ClassTag[T]): Array[T] = Array(xs*) | array(1, 2) |}""".stripMargin, newArray2Opcodes(T_INT, List(Op(DUP), Op(ICONST_0), Op(ICONST_1), Op(IASTORE), Op(DUP), Op(ICONST_1), Op(ICONST_2), Op(IASTORE), TypeOp(CHECKCAST, "[I"))) diff --git a/compiler/test/dotty/tools/backend/jvm/AsmConverters.scala b/compiler/test/dotty/tools/backend/jvm/AsmConverters.scala index a7900994d402..c751937bd9f9 100644 --- a/compiler/test/dotty/tools/backend/jvm/AsmConverters.scala +++ b/compiler/test/dotty/tools/backend/jvm/AsmConverters.scala @@ -245,7 +245,7 @@ object ASMConverters { case Jump(op, label) => method.visitJumpInsn(op, asmLabel(label)) case Ldc(op, cst) => method.visitLdcInsn(cst) case LookupSwitch(op, dflt, keys, labels) => method.visitLookupSwitchInsn(asmLabel(dflt), keys.toArray, (labels map asmLabel).toArray) - case TableSwitch(op, min, max, dflt, labels) => method.visitTableSwitchInsn(min, max, asmLabel(dflt), (labels map asmLabel).toArray: _*) + case TableSwitch(op, min, max, dflt, labels) => method.visitTableSwitchInsn(min, max, asmLabel(dflt), (labels map asmLabel).toArray*) case Invoke(op, owner, name, desc, itf) => method.visitMethodInsn(op, owner, name, desc, itf) case InvokeDynamic(op, name, desc, bsm, bsmArgs) => method.visitInvokeDynamicInsn(name, desc, unconvertMethodHandle(bsm), unconvertBsmArgs(bsmArgs)) case NewArray(op, desc, dims) => method.visitMultiANewArrayInsn(desc, dims) diff --git a/compiler/test/dotty/tools/backend/jvm/DottyBytecodeTests.scala b/compiler/test/dotty/tools/backend/jvm/DottyBytecodeTests.scala index 29119c8d081f..33b18318d59f 100644 --- a/compiler/test/dotty/tools/backend/jvm/DottyBytecodeTests.scala +++ b/compiler/test/dotty/tools/backend/jvm/DottyBytecodeTests.scala @@ -308,7 +308,7 @@ class DottyBytecodeTests extends DottyBytecodeTest { |import java.nio.file._ |class Test { | def test(xs: Array[String]) = { - | val p4 = Paths.get("Hello", xs: _*) + | val p4 = Paths.get("Hello", xs*) | } |} """.stripMargin diff --git a/compiler/test/dotty/tools/dotc/BootstrappedOnlyCompilationTests.scala b/compiler/test/dotty/tools/dotc/BootstrappedOnlyCompilationTests.scala index 9529f94a3890..88b9fe0c649d 100644 --- a/compiler/test/dotty/tools/dotc/BootstrappedOnlyCompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/BootstrappedOnlyCompilationTests.scala @@ -135,7 +135,7 @@ class BootstrappedOnlyCompilationTests { if scala.util.Properties.isWin then basicTests else compileDir("tests/old-tasty-interpreter-prototype", withTastyInspectorOptions) :: basicTests - aggregateTests(tests: _*).checkRuns() + aggregateTests(tests*).checkRuns() } @Test def runBootstrappedOnly: Unit = { diff --git a/compiler/test/dotty/tools/dotc/IdempotencyTests.scala b/compiler/test/dotty/tools/dotc/IdempotencyTests.scala index b515ebb05f96..81dd7d7f4710 100644 --- a/compiler/test/dotty/tools/dotc/IdempotencyTests.scala +++ b/compiler/test/dotty/tools/dotc/IdempotencyTests.scala @@ -45,7 +45,7 @@ class IdempotencyTests { compileList(testDir.getName, sources.reverse, opt)(TestGroup("idempotency/orderIdempotency2")) ) } - aggregateTests(tests: _*) + aggregateTests(tests*) } def check(name: String) = { diff --git a/compiler/test/dotty/tools/dotc/core/tasty/CommentPicklingTest.scala b/compiler/test/dotty/tools/dotc/core/tasty/CommentPicklingTest.scala index 0af4434fdcde..45b807f73079 100644 --- a/compiler/test/dotty/tools/dotc/core/tasty/CommentPicklingTest.scala +++ b/compiler/test/dotty/tools/dotc/core/tasty/CommentPicklingTest.scala @@ -92,7 +92,7 @@ class CommentPicklingTest { val out = tmp./("out") out.createDirectory() - val options = compileOptions.and("-d", out.toAbsolute.toString).and(sourceFiles: _*) + val options = compileOptions.and("-d", out.toAbsolute.toString).and(sourceFiles*) val reporter = TestReporter.reporter(System.out, logLevel = ERROR) Main.process(options.all, reporter) assertFalse("Compilation failed.", reporter.hasErrors) diff --git a/compiler/test/dotty/tools/dotc/semanticdb/SemanticdbTests.scala b/compiler/test/dotty/tools/dotc/semanticdb/SemanticdbTests.scala index de8c2c11f9c2..8839a6cd03b1 100644 --- a/compiler/test/dotty/tools/dotc/semanticdb/SemanticdbTests.scala +++ b/compiler/test/dotty/tools/dotc/semanticdb/SemanticdbTests.scala @@ -130,7 +130,7 @@ class SemanticdbTests: val target = Files.createTempDirectory("semanticdb") val javaArgs = Array("-d", target.toString) ++ javaFiles().map(_.toString) val javac = ToolProvider.getSystemJavaCompiler - val exitJava = javac.run(null, null, null, javaArgs:_*) + val exitJava = javac.run(null, null, null, javaArgs*) assert(exitJava == 0, "java compiler has errors") val args = Array( "-Xsemanticdb", diff --git a/compiler/test/dotty/tools/scripting/ClasspathTests.scala b/compiler/test/dotty/tools/scripting/ClasspathTests.scala index 0f3ada041538..4fd1211698f6 100755 --- a/compiler/test/dotty/tools/scripting/ClasspathTests.scala +++ b/compiler/test/dotty/tools/scripting/ClasspathTests.scala @@ -43,7 +43,7 @@ class ClasspathTests: // cwd: // classpath: - val scriptOutput: Seq[String] = exec(cmd:_*) + val scriptOutput: Seq[String] = exec(cmd*) val scriptCwd: String = findTaggedLine("cwd", scriptOutput) // the value tagged "cwd: " printf("script ran in directory [%s]\n", scriptCwd) val scriptCp = findTaggedLine("classpath", scriptOutput) // the value tagged "classpath: " @@ -94,7 +94,7 @@ class ClasspathTests: cmd.foreach { printf("[%s]\n", _) } // test script reports the classpath it sees - val scriptOutput = exec(cmd:_*) + val scriptOutput = exec(cmd*) val scriptCp = findTaggedLine("unglobbed classpath", scriptOutput) printf("%s\n", scriptCp) val classpathJars = scriptCp.split(psep).map { _.getName }.sorted.distinct diff --git a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala index 8d07002ac620..4804ffd349cb 100644 --- a/compiler/test/dotty/tools/vulpix/ParallelTesting.scala +++ b/compiler/test/dotty/tools/vulpix/ParallelTesting.scala @@ -85,18 +85,18 @@ trait ParallelTesting extends RunnerOrchestration { self => val newFlags = newFlags0.toArray if (!flags.options.containsSlice(newFlags)) self match { case self: JointCompilationSource => - self.copy(flags = flags.and(newFlags:_*)) + self.copy(flags = flags.and(newFlags*)) case self: SeparateCompilationSource => - self.copy(flags = flags.and(newFlags:_*)) + self.copy(flags = flags.and(newFlags*)) } else self } def withoutFlags(flags1: String*): TestSource = self match { case self: JointCompilationSource => - self.copy(flags = flags.without(flags1: _*)) + self.copy(flags = flags.without(flags1*)) case self: SeparateCompilationSource => - self.copy(flags = flags.without(flags1: _*)) + self.copy(flags = flags.without(flags1*)) } lazy val allToolArgs: ToolArgs = @@ -490,7 +490,7 @@ trait ParallelTesting extends RunnerOrchestration { self => def scalacOptions = toolArgs.getOrElse(ToolName.Scalac, Nil) val flags = flags0 - .and(scalacOptions: _*) + .and(scalacOptions*) .and("-d", targetDir.getPath) .withClasspath(targetDir.getPath) diff --git a/language-server/test/dotty/tools/languageserver/util/Code.scala b/language-server/test/dotty/tools/languageserver/util/Code.scala index 7eb2d377cb54..f88dff70ecaf 100644 --- a/language-server/test/dotty/tools/languageserver/util/Code.scala +++ b/language-server/test/dotty/tools/languageserver/util/Code.scala @@ -48,7 +48,7 @@ object Code { * perform actions such as finding all references, etc. */ def code(args: Embedded*): ScalaSourceWithPositions = { - val (text, positions) = textAndPositions(args: _*) + val (text, positions) = textAndPositions(args*) ScalaSourceWithPositions(text, positions) } @@ -58,7 +58,7 @@ object Code { * @see code */ def ws(args: Embedded*): WorksheetWithPositions = { - val (text, positions) = textAndPositions(args: _*) + val (text, positions) = textAndPositions(args*) WorksheetWithPositions(text, positions) } @@ -69,7 +69,7 @@ object Code { * @see code */ def tasty(args: Embedded*): TastyWithPositions = { - val (text, positions) = textAndPositions(args: _*) + val (text, positions) = textAndPositions(args*) TastyWithPositions(text, positions) } diff --git a/library/src/scala/IArray.scala b/library/src/scala/IArray.scala index e284c2e35c2f..887ca517ef2b 100644 --- a/library/src/scala/IArray.scala +++ b/library/src/scala/IArray.scala @@ -411,25 +411,25 @@ object IArray: def emptyObjectIArray: IArray[Object] = Array.emptyObjectArray /** An immutable array with given elements. */ - def apply[T](xs: T*)(using ct: ClassTag[T]): IArray[T] = Array(xs: _*) + def apply[T](xs: T*)(using ct: ClassTag[T]): IArray[T] = Array(xs*) /** An immutable array with given elements. */ - def apply(x: Boolean, xs: Boolean*): IArray[Boolean] = Array(x, xs: _*) + def apply(x: Boolean, xs: Boolean*): IArray[Boolean] = Array(x, xs*) /** An immutable array with given elements. */ - def apply(x: Byte, xs: Byte*): IArray[Byte] = Array(x, xs: _*) + def apply(x: Byte, xs: Byte*): IArray[Byte] = Array(x, xs*) /** An immutable array with given elements. */ - def apply(x: Short, xs: Short*): IArray[Short] = Array(x, xs: _*) + def apply(x: Short, xs: Short*): IArray[Short] = Array(x, xs*) /** An immutable array with given elements. */ - def apply(x: Char, xs: Char*): IArray[Char] = Array(x, xs: _*) + def apply(x: Char, xs: Char*): IArray[Char] = Array(x, xs*) /** An immutable array with given elements. */ - def apply(x: Int, xs: Int*): IArray[Int] = Array(x, xs: _*) + def apply(x: Int, xs: Int*): IArray[Int] = Array(x, xs*) /** An immutable array with given elements. */ - def apply(x: Long, xs: Long*): IArray[Long] = Array(x, xs: _*) + def apply(x: Long, xs: Long*): IArray[Long] = Array(x, xs*) /** An immutable array with given elements. */ - def apply(x: Float, xs: Float*): IArray[Float] = Array(x, xs: _*) + def apply(x: Float, xs: Float*): IArray[Float] = Array(x, xs*) /** An immutable array with given elements. */ - def apply(x: Double, xs: Double*): IArray[Double] = Array(x, xs: _*) + def apply(x: Double, xs: Double*): IArray[Double] = Array(x, xs*) /** An immutable array with given elements. */ - def apply(x: Unit, xs: Unit*): IArray[Unit] = Array(x, xs: _*) + def apply(x: Unit, xs: Unit*): IArray[Unit] = Array(x, xs*) /** Build an array from the iterable collection. * @@ -459,7 +459,7 @@ object IArray: // `Array.concat` should arguably take in a `Seq[Array[_ <: T]]`, // but since it currently takes a `Seq[Array[T]]` we have to perform a cast, // knowing tacitly that `concat` is not going to do the wrong thing. - Array.concat[T](xss.asInstanceOf[Seq[Array[T]]]: _*) + Array.concat[T](xss.asInstanceOf[Seq[Array[T]]]*) /** Returns an immutable array that contains the results of some element computation a number * of times. Each element is determined by a separate computation. diff --git a/library/src/scala/quoted/Expr.scala b/library/src/scala/quoted/Expr.scala index 8243e7dc4a4b..03afedae8f49 100644 --- a/library/src/scala/quoted/Expr.scala +++ b/library/src/scala/quoted/Expr.scala @@ -69,7 +69,7 @@ object Expr { * `'{ List($e1, $e2, ...) }` typed as an `Expr[List[T]]` */ def ofList[T](xs: Seq[Expr[T]])(using Type[T])(using Quotes): Expr[List[T]] = - if (xs.isEmpty) Expr(Nil) else '{ List(${Varargs(xs)}: _*) } + if xs.isEmpty then Expr(Nil) else '{ List(${Varargs(xs)}*) } /** Creates an expression that will construct a copy of this tuple * diff --git a/library/src/scala/quoted/FromExpr.scala b/library/src/scala/quoted/FromExpr.scala index f81afc627609..aadea9bcb0b6 100644 --- a/library/src/scala/quoted/FromExpr.scala +++ b/library/src/scala/quoted/FromExpr.scala @@ -133,13 +133,13 @@ object FromExpr { } /** Default implementation of `FromExpr[StringContext]` - * - Transform `'{StringContext(args: _*)}` into `Some(StringContext(args: _*))` if `args` is explicit and each one is liftable + * - Transform `'{StringContext(args*)}` into `Some(StringContext(args*))` if `args` is explicit and each one is liftable * - Otherwise returns `None` */ given StringContextFromExpr: FromExpr[StringContext] with { def unapply(x: Expr[StringContext])(using Quotes) = x match { - case '{ new StringContext(${Varargs(Exprs(args))}: _*) } => Some(StringContext(args: _*)) - case '{ StringContext(${Varargs(Exprs(args))}: _*) } => Some(StringContext(args: _*)) + case '{ new StringContext(${Varargs(Exprs(args))}*) } => Some(StringContext(args*)) + case '{ StringContext(${Varargs(Exprs(args))}*) } => Some(StringContext(args*)) case _ => None } } @@ -428,8 +428,8 @@ object FromExpr { given SeqFromExpr[T](using Type[T], FromExpr[T]): FromExpr[Seq[T]] with { def unapply(x: Expr[Seq[T]])(using Quotes) = x match { case Varargs(Exprs(elems)) => Some(elems) - case '{ scala.Seq[T](${Varargs(Exprs(elems))}: _*) } => Some(elems) - case '{ scala.collection.immutable.Seq[T](${Varargs(Exprs(elems))}: _*) } => Some(elems) + case '{ scala.Seq[T](${Varargs(Exprs(elems))}*) } => Some(elems) + case '{ scala.collection.immutable.Seq[T](${Varargs(Exprs(elems))}*) } => Some(elems) case '{ ${Expr(x)}: List[T] } => Some(x) case _ => None } @@ -454,10 +454,10 @@ object FromExpr { */ given ListFromExpr[T](using Type[T], FromExpr[T]): FromExpr[List[T]] with { def unapply(x: Expr[List[T]])(using Quotes) = x match { - case '{ scala.List[T](${Varargs(Exprs(elems))}: _*) } => Some(elems.toList) + case '{ scala.List[T](${Varargs(Exprs(elems))}*) } => Some(elems.toList) case '{ scala.List.empty[T] } => Some(Nil) case '{ Nil } => Some(Nil) - case '{ scala.collection.immutable.List[T](${Varargs(Exprs(elems))}: _*) } => Some(elems.toList) + case '{ scala.collection.immutable.List[T](${Varargs(Exprs(elems))}*) } => Some(elems.toList) case '{ scala.collection.immutable.List.empty[T] } => Some(Nil) case _ => None } @@ -470,9 +470,9 @@ object FromExpr { */ given SetFromExpr[T](using Type[T], FromExpr[T]): FromExpr[Set[T]] with { def unapply(x: Expr[Set[T]])(using Quotes) = x match { - case '{ Set[T](${Varargs(Exprs(elems))}: _*) } => Some(elems.toSet) + case '{ Set[T](${Varargs(Exprs(elems))}*) } => Some(elems.toSet) case '{ Set.empty[T] } => Some(Set.empty[T]) - case '{ scala.collection.immutable.Set[T](${Varargs(Exprs(elems))}: _*) } => Some(elems.toSet) + case '{ scala.collection.immutable.Set[T](${Varargs(Exprs(elems))}*) } => Some(elems.toSet) case '{ scala.collection.immutable.Set.empty[T] } => Some(Set.empty[T]) case _ => None } @@ -485,9 +485,9 @@ object FromExpr { */ given MapFromExpr[T, U](using Type[T], Type[U], FromExpr[T], FromExpr[U]): FromExpr[Map[T, U]] with { def unapply(x: Expr[Map[T, U]])(using Quotes) = x match { - case '{ Map[T, U](${Varargs(Exprs(elems))}: _*) } => Some(elems.toMap) + case '{ Map[T, U](${Varargs(Exprs(elems))}*) } => Some(elems.toMap) case '{ Map.empty[T, U] } => Some(Map.empty) - case '{ scala.collection.immutable.Map[T, U](${Varargs(Exprs(elems))}: _*) } => Some(elems.toMap) + case '{ scala.collection.immutable.Map[T, U](${Varargs(Exprs(elems))}*) } => Some(elems.toMap) case '{ scala.collection.immutable.Map.empty[T, U] } => Some(Map.empty) case _ => None } diff --git a/library/src/scala/quoted/ToExpr.scala b/library/src/scala/quoted/ToExpr.scala index 0e31c4590a26..883b55833af5 100644 --- a/library/src/scala/quoted/ToExpr.scala +++ b/library/src/scala/quoted/ToExpr.scala @@ -97,63 +97,63 @@ object ToExpr { /** Default implementation of `ToExpr[Array[T]]` */ given ArrayToExpr[T: Type: ToExpr: ClassTag]: ToExpr[Array[T]] with { def apply(arr: Array[T])(using Quotes): Expr[Array[T]] = - '{ Array[T](${Expr(arr.toSeq)}: _*)(${Expr(summon[ClassTag[T]])}) } + '{ Array[T](${Expr(arr.toSeq)}*)(${Expr(summon[ClassTag[T]])}) } } /** Default implementation of `ToExpr[Array[Boolean]]` */ given ArrayOfBooleanToExpr: ToExpr[Array[Boolean]] with { def apply(array: Array[Boolean])(using Quotes): Expr[Array[Boolean]] = if (array.length == 0) '{ Array.emptyBooleanArray } - else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } + else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}*) } } /** Default implementation of `ToExpr[Array[Byte]]` */ given ArrayOfByteToExpr: ToExpr[Array[Byte]] with { def apply(array: Array[Byte])(using Quotes): Expr[Array[Byte]] = if (array.length == 0) '{ Array.emptyByteArray } - else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } + else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}*) } } /** Default implementation of `ToExpr[Array[Short]]` */ given ArrayOfShortToExpr: ToExpr[Array[Short]] with { def apply(array: Array[Short])(using Quotes): Expr[Array[Short]] = if (array.length == 0) '{ Array.emptyShortArray } - else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } + else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}*) } } /** Default implementation of `ToExpr[Array[Char]]` */ given ArrayOfCharToExpr: ToExpr[Array[Char]] with { def apply(array: Array[Char])(using Quotes): Expr[Array[Char]] = if (array.length == 0) '{ Array.emptyCharArray } - else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } + else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}*) } } /** Default implementation of `ToExpr[Array[Int]]` */ given ArrayOfIntToExpr: ToExpr[Array[Int]] with { def apply(array: Array[Int])(using Quotes): Expr[Array[Int]] = if (array.length == 0) '{ Array.emptyIntArray } - else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } + else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}*) } } /** Default implementation of `ToExpr[Array[Long]]` */ given ArrayOfLongToExpr: ToExpr[Array[Long]] with { def apply(array: Array[Long])(using Quotes): Expr[Array[Long]] = if (array.length == 0) '{ Array.emptyLongArray } - else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } + else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}*) } } /** Default implementation of `ToExpr[Array[Float]]` */ given ArrayOfFloatToExpr: ToExpr[Array[Float]] with { def apply(array: Array[Float])(using Quotes): Expr[Array[Float]] = if (array.length == 0) '{ Array.emptyFloatArray } - else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } + else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}*) } } /** Default implementation of `ToExpr[Array[Double]]` */ given ArrayOfDoubleToExpr: ToExpr[Array[Double]] with { def apply(array: Array[Double])(using Quotes): Expr[Array[Double]] = if (array.length == 0) '{ Array.emptyDoubleArray } - else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } + else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}*) } } /** Default implementation of `ToExpr[IArray[T]]` */ @@ -183,13 +183,13 @@ object ToExpr { /** Default implementation of `ToExpr[Set[T]]` */ given SetToExpr[T: Type: ToExpr]: ToExpr[Set[T]] with { def apply(set: Set[T])(using Quotes): Expr[Set[T]] = - '{ Set(${Expr(set.toSeq)}: _*) } + '{ Set(${Expr(set.toSeq)}*) } } /** Default implementation of `ToExpr[Map[T, U]]` */ given MapToExpr[T: Type: ToExpr, U: Type: ToExpr]: ToExpr[Map[T, U]] with { def apply(map: Map[T, U])(using Quotes): Expr[Map[T, U]] = - '{ Map(${Expr(map.toSeq)}: _*) } + '{ Map(${Expr(map.toSeq)}*) } } /** Default implementation of `ToExpr[Option[T]]` */ @@ -430,7 +430,7 @@ object ToExpr { given StringContextToExpr: ToExpr[StringContext] with { def apply(stringContext: StringContext)(using Quotes): Expr[StringContext] = val parts = Varargs(stringContext.parts.map(Expr(_))) - '{ StringContext($parts: _*) } + '{ StringContext($parts*) } } } diff --git a/library/src/scala/reflect/Selectable.scala b/library/src/scala/reflect/Selectable.scala index 183571c35aa7..6da2b0ff88cd 100644 --- a/library/src/scala/reflect/Selectable.scala +++ b/library/src/scala/reflect/Selectable.scala @@ -35,9 +35,9 @@ trait Selectable extends scala.Selectable: */ final def applyDynamic(name: String, paramTypes: Class[?]*)(args: Any*): Any = val rcls = selectedValue.getClass - val mth = rcls.getMethod(name, paramTypes: _*).nn + val mth = rcls.getMethod(name, paramTypes*).nn ensureAccessible(mth) - mth.invoke(selectedValue, args.asInstanceOf[Seq[AnyRef]]: _*) + mth.invoke(selectedValue, args.asInstanceOf[Seq[AnyRef]]*) object Selectable: diff --git a/library/src/scala/runtime/Arrays.scala b/library/src/scala/runtime/Arrays.scala index 96a26aad2486..9f5bdd99a5f4 100644 --- a/library/src/scala/runtime/Arrays.scala +++ b/library/src/scala/runtime/Arrays.scala @@ -27,5 +27,5 @@ object Arrays { /** Create an array of a reference type T. */ def newArray[Arr](componentType: Class[?], returnType: Class[Arr], dimensions: Array[Int]): Arr = - jlr.Array.newInstance(componentType, dimensions: _*).asInstanceOf[Arr] + jlr.Array.newInstance(componentType, dimensions*).asInstanceOf[Arr] } diff --git a/library/src/scala/runtime/TupleXXL.scala b/library/src/scala/runtime/TupleXXL.scala index 22c3cc521427..b4a81d60f817 100644 --- a/library/src/scala/runtime/TupleXXL.scala +++ b/library/src/scala/runtime/TupleXXL.scala @@ -43,6 +43,6 @@ final class TupleXXL private (es: IArray[Object]) extends Product { object TupleXXL { def fromIterator(elems: Iterator[Any]): TupleXXL = new TupleXXL(elems.map(_.asInstanceOf[Object]).toArray.asInstanceOf[IArray[Object]]) // TODO use Iterator.toIArray def fromIArray(elems: IArray[Object]): TupleXXL = new TupleXXL(elems) - def apply(elems: Any*): TupleXXL = new TupleXXL(IArray(elems.asInstanceOf[Seq[AnyRef]]: _*)) + def apply(elems: Any*): TupleXXL = new TupleXXL(IArray(elems.asInstanceOf[Seq[AnyRef]]*)) def unapplySeq(x: TupleXXL): Option[Seq[Any]] = Some(x.elems.asInstanceOf[Array[Object]].toSeq) // TODO use IArray.toSeq } diff --git a/library/src/scala/runtime/stdLibPatches/language.scala b/library/src/scala/runtime/stdLibPatches/language.scala index fbab0c14c9fb..c2a12cec2ecc 100644 --- a/library/src/scala/runtime/stdLibPatches/language.scala +++ b/library/src/scala/runtime/stdLibPatches/language.scala @@ -114,6 +114,10 @@ object language: */ @compileTimeOnly("`symbolLiterals` can only be used at compile time in import statements") object symbolLiterals + + /** TODO */ + @compileTimeOnly("`ascriptionVarargsUnpacking` can only be used at compile time in import statements") + object ascriptionVarargsUnpacking end deprecated /** Where imported, auto-tupling is disabled. diff --git a/project/Build.scala b/project/Build.scala index 13ebe9c028ae..14e9319fc34e 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -1008,7 +1008,10 @@ object Build { Seq("-sourcepath", ((Compile/sourceManaged).value / "scala-library-src").toString) }, Compile / doc / scalacOptions += "-Ydocument-synthetic-types", - scalacOptions += "-Ycompile-scala2-library", + scalacOptions ++= Seq( + "-Ycompile-scala2-library", + "-language:deprecated.ascriptionVarargsUnpacking", + ), scalacOptions -= "-Xfatal-warnings", ivyConfigurations += SourceDeps.hide, transitiveClassifiers := Seq("sources"), @@ -1361,6 +1364,7 @@ object Build { dependsOn(`scala3-library-bootstrappedJS`). settings( bspEnabled := false, + scalacOptions += "-language:deprecated.ascriptionVarargsUnpacking", scalacOptions --= Seq("-Xfatal-warnings", "-deprecation"), // Required to run Scala.js tests. diff --git a/sbt-test/sbt-dotty/scaladoc/src/main/scala/PatternMatching.scala b/sbt-test/sbt-dotty/scaladoc/src/main/scala/PatternMatching.scala index 7e310cf3ea5e..eea425249d37 100644 --- a/sbt-test/sbt-dotty/scaladoc/src/main/scala/PatternMatching.scala +++ b/sbt-test/sbt-dotty/scaladoc/src/main/scala/PatternMatching.scala @@ -70,8 +70,8 @@ object PatternMatching { // http://dotty.epfl.ch/docs/reference/changed/vararg-patterns.html def containsConsecutive(list: List[Int]): Boolean = list match { - case List(a, b, xs: _ *) => if (a == b) true else containsConsecutive(b :: xs.toList) - case List(a, _ : _*) => false + case List(a, b, xs*) => if (a == b) true else containsConsecutive(b :: xs.toList) + case List(a, _*) => false case Nil => false } @@ -86,7 +86,7 @@ object PatternMatching { import seqPattern._ def greet(fullName: String) = fullName match { - case Names(lastName, firstName, _: _*) => "Good morning, " + firstName + " " + lastName + "!" + case Names(lastName, firstName, _*) => "Good morning, " + firstName + " " + lastName + "!" case _ => "Welcome! Please make sure to fill in your name!" } diff --git a/scaladoc-js/common/src/utils/html.scala b/scaladoc-js/common/src/utils/html.scala index 1a7f108a3555..0eadf028000f 100644 --- a/scaladoc-js/common/src/utils/html.scala +++ b/scaladoc-js/common/src/utils/html.scala @@ -12,8 +12,8 @@ object HTML { case class Tag[T <: domhtml.Element](private val elemFactory: () => T): private def textNode(s: String): Text = document.createTextNode(s) - def apply(tags: TagArg*): T = apply()(tags:_*) - def apply(first: AttrArg, rest: AttrArg*): T = apply((first +: rest):_*)() + def apply(tags: TagArg*): T = apply()(tags*) + def apply(first: AttrArg, rest: AttrArg*): T = apply((first +: rest)*)() def apply(attrs: AttrArg*)(tags: TagArg*): T = val elem: T = elemFactory() def unpackTags(tags: TagArg*): Unit = tags.foreach { @@ -29,8 +29,8 @@ object HTML { case s: Seq[AppliedAttr] => unpackAttributes(s*) } - unpackTags(tags:_*) - unpackAttributes(attrs:_*) + unpackTags(tags*) + unpackAttributes(attrs*) elem object Tag: diff --git a/scaladoc/src/dotty/tools/scaladoc/parsers/WikiCodeBlockParser.scala b/scaladoc/src/dotty/tools/scaladoc/parsers/WikiCodeBlockParser.scala index 4201cae4e2e6..e6ebe0d2cc7a 100644 --- a/scaladoc/src/dotty/tools/scaladoc/parsers/WikiCodeBlockParser.scala +++ b/scaladoc/src/dotty/tools/scaladoc/parsers/WikiCodeBlockParser.scala @@ -142,7 +142,7 @@ class WikiCodeBlockParser( codeBlock.setCharsFromContent block.appendChild(codeBlock) } else { - val codeBlock = new Text(SegmentedSequence.create(segments.asScala.toSeq:_*)) + val codeBlock = new Text(SegmentedSequence.create(segments.asScala.toSeq*)) block.appendChild(codeBlock) } } diff --git a/scaladoc/src/dotty/tools/scaladoc/renderers/HtmlRenderer.scala b/scaladoc/src/dotty/tools/scaladoc/renderers/HtmlRenderer.scala index 872f8a4f09c9..20f3335a44ef 100644 --- a/scaladoc/src/dotty/tools/scaladoc/renderers/HtmlRenderer.scala +++ b/scaladoc/src/dotty/tools/scaladoc/renderers/HtmlRenderer.scala @@ -32,8 +32,8 @@ class HtmlRenderer(rootPackage: Member, members: Map[DRI, Member])(using ctx: Do case _ => Nil) :+ (Attr("data-pathToRoot") := pathToRoot(page.link.dri)) - val htmlTag = html(attrs: _*)( - head((mkHead(page) :+ docHead):_*), + val htmlTag = html(attrs*)( + head((mkHead(page) :+ docHead)*), body( if !page.hasFrame then docBody else mkFrame(page.link, parents, docBody, toc) @@ -216,7 +216,7 @@ class HtmlRenderer(rootPackage: Member, members: Map[DRI, Member])(using ctx: Do a(href := pathToPage(link.dri, b.dri))(b.name), "/" )).dropRight(1) - div(cls := "breadcrumbs container")(innerTags:_*) + div(cls := "breadcrumbs container")(innerTags*) val (apiNavOpt, docsNavOpt): (Option[(Boolean, Seq[AppliedTag])], Option[(Boolean, Seq[AppliedTag])]) = buildNavigation(link) diff --git a/scaladoc/src/dotty/tools/scaladoc/renderers/MemberRenderer.scala b/scaladoc/src/dotty/tools/scaladoc/renderers/MemberRenderer.scala index 996b422b44fd..612444fd4ffd 100644 --- a/scaladoc/src/dotty/tools/scaladoc/renderers/MemberRenderer.scala +++ b/scaladoc/src/dotty/tools/scaladoc/renderers/MemberRenderer.scala @@ -26,7 +26,7 @@ class MemberRenderer(signatureRenderer: SignatureRenderer)(using DocContext) ext val headNode = m.inheritedFrom.map(form => signatureRenderer.renderLink(form.name, form.dri)) val tailNodes = defs.flatMap(renderDef) val nodes = headNode.fold(tailNodes.drop(1))(_ +: tailNodes) - tableRow("Definition Classes", div(nodes:_*)) + tableRow("Definition Classes", div(nodes*)) case _ => Nil @@ -250,7 +250,7 @@ class MemberRenderer(signatureRenderer: SignatureRenderer)(using DocContext) ext val memberInf = memberInfo(member, withBrief = true) val annots = annotations(member) - div(topLevelAttr:_*)( + div(topLevelAttr*)( div(cls := "documentableElement-expander")( Option.when(annots.nonEmpty || originInf.nonEmpty || memberInf.nonEmpty)(button(cls := "icon-button ar show-content")).toList, annots.map(div(_)).toList, diff --git a/scaladoc/src/dotty/tools/scaladoc/renderers/Resources.scala b/scaladoc/src/dotty/tools/scaladoc/renderers/Resources.scala index b84c07b4bade..3e49af2e0576 100644 --- a/scaladoc/src/dotty/tools/scaladoc/renderers/Resources.scala +++ b/scaladoc/src/dotty/tools/scaladoc/renderers/Resources.scala @@ -20,7 +20,7 @@ enum Resource(val path: String): trait Resources(using ctx: DocContext) extends Locations, Writer: private def dynamicJsData = val str = jsonObject("filterDefaults" -> jsonObject( - FilterAttributes.defaultValues.toSeq.map { case (n, v) => n -> jsonString(v) }:_* + FilterAttributes.defaultValues.toSeq.map { case (n, v) => n -> jsonString(v) }* )) Resource.Text("scripts/data.js", s"var scaladocData = $str") diff --git a/scaladoc/src/dotty/tools/scaladoc/renderers/SignatureRenderer.scala b/scaladoc/src/dotty/tools/scaladoc/renderers/SignatureRenderer.scala index 5c6235b14e7d..65c67d3457a5 100644 --- a/scaladoc/src/dotty/tools/scaladoc/renderers/SignatureRenderer.scala +++ b/scaladoc/src/dotty/tools/scaladoc/renderers/SignatureRenderer.scala @@ -18,7 +18,7 @@ trait SignatureRenderer: def renderElement(e: SignaturePart, modifiers: AppliedAttr*): AppliedTag = renderElementWith(e, modifiers*) def renderLink(name: String, dri: DRI, modifiers: AppliedAttr*) = - renderLinkContent(name, dri, modifiers:_*) + renderLinkContent(name, dri, modifiers*) def unresolvedLink(content: TagArg, modifiers: AppliedAttr*) = span(Attr("data-unresolved-link") := "", modifiers)(content) @@ -26,7 +26,7 @@ trait SignatureRenderer: def renderLinkContent(content: TagArg, dri: DRI, modifiers: AppliedAttr*) = link(dri) match case Some(link) => a(href := link, modifiers)(content) - case _ => unresolvedLink(content, modifiers:_*) + case _ => unresolvedLink(content, modifiers*) def renderElementWith(e: SignaturePart, modifiers: AppliedAttr*) = e match case Name(name, dri) => @@ -34,7 +34,7 @@ trait SignatureRenderer: renderLink(name, dri, attrs*) case Type(name, Some(dri)) => val attrs = Seq(Attr("t") := "t") ++ modifiers - renderLink(name, dri, attrs:_*) + renderLink(name, dri, attrs*) case Type(name, None) => span(Attr("t") := "t")(name) case Keyword(name) => span(Attr("t") := "k")(name) case Plain(name) => raw(name) diff --git a/scaladoc/src/dotty/tools/scaladoc/tasty/comments/MarkdownParser.scala b/scaladoc/src/dotty/tools/scaladoc/tasty/comments/MarkdownParser.scala index edf9051c0ed7..77d57748a2e8 100644 --- a/scaladoc/src/dotty/tools/scaladoc/tasty/comments/MarkdownParser.scala +++ b/scaladoc/src/dotty/tools/scaladoc/tasty/comments/MarkdownParser.scala @@ -38,7 +38,7 @@ object MarkdownParser { new MutableDataSet() .setFrom(ParserEmulationProfile.COMMONMARK.getOptions) - .set(Parser.EXTENSIONS, Arrays.asList(extArray:_*)) + .set(Parser.EXTENSIONS, Arrays.asList(extArray*)) .set(EmojiExtension.ROOT_IMAGE_PATH, "https://github.global.ssl.fastly.net/images/icons/emoji/") .set(WikiLinkExtension.LINK_ESCAPE_CHARS, "") diff --git a/scaladoc/src/dotty/tools/scaladoc/tasty/comments/Preparser.scala b/scaladoc/src/dotty/tools/scaladoc/tasty/comments/Preparser.scala index 95db8983626a..9fad9e22eeb9 100644 --- a/scaladoc/src/dotty/tools/scaladoc/tasty/comments/Preparser.scala +++ b/scaladoc/src/dotty/tools/scaladoc/tasty/comments/Preparser.scala @@ -130,7 +130,7 @@ object Preparser { val tagsWithoutDiagram = tags.filterNot(pair => stripTags.contains(pair._1)) val bodyTags: mutable.Map[TagKey, List[String]] = - mutable.Map((tagsWithoutDiagram).toSeq: _*) + mutable.Map((tagsWithoutDiagram).toSeq*) def allTags(key: SimpleTagKey): List[String] = (bodyTags remove key).getOrElse(Nil).reverse diff --git a/scaladoc/src/dotty/tools/scaladoc/util/html.scala b/scaladoc/src/dotty/tools/scaladoc/util/html.scala index 9d832d28ee0b..f7d99eaf4927 100644 --- a/scaladoc/src/dotty/tools/scaladoc/util/html.scala +++ b/scaladoc/src/dotty/tools/scaladoc/util/html.scala @@ -9,8 +9,8 @@ object HTML: type TagArg = AppliedTag | Seq[AppliedTag] | String | Seq[String] case class Tag(name: String): - def apply(tags: TagArg*): AppliedTag = apply()(tags:_*) - def apply(first: AttrArg, rest: AttrArg*): AppliedTag = apply((first +: rest):_*)() + def apply(tags: TagArg*): AppliedTag = apply()(tags*) + def apply(first: AttrArg, rest: AttrArg*): AppliedTag = apply((first +: rest)*)() def apply(attrs: AttrArg*)(tags: TagArg*): AppliedTag = def unpackTags(tags: TagArg*)(using sb: StringBuilder): StringBuilder = tags.foreach { @@ -19,7 +19,7 @@ object HTML: case s: String => sb.append(s.escapeReservedTokens) case s: Seq[AppliedTag | String] => - unpackTags(s:_*) + unpackTags(s*) } sb val sb = StringBuilder() @@ -31,7 +31,7 @@ object HTML: sb.append(" ").append(e) } sb.append(">") - unpackTags(tags:_*)(using sb) + unpackTags(tags*)(using sb) sb.append(s"") sb diff --git a/scaladoc/test/dotty/tools/scaladoc/site/NavigationTest.scala b/scaladoc/test/dotty/tools/scaladoc/site/NavigationTest.scala index f137e9e6b13e..fe822df5f8a0 100644 --- a/scaladoc/test/dotty/tools/scaladoc/site/NavigationTest.scala +++ b/scaladoc/test/dotty/tools/scaladoc/site/NavigationTest.scala @@ -11,8 +11,8 @@ class NavigationTest extends BaseHtmlTest: withHtmlFile(page){ content => def test(query: String, el: Seq[NavMenuTestEntry]) = - content.assertTextsIn(query, el.map(_.name):_*) - content.assertAttr(query,"href", el.map(_.link):_*) + content.assertTextsIn(query, el.map(_.name)*) + content.assertAttr(query,"href", el.map(_.link)*) test(".side-menu>div>span>a", topLevel) test(".side-menu>div>div>span>a", topLevel.flatMap(_.nested)) diff --git a/scaladoc/test/dotty/tools/scaladoc/site/SiteGeneratationTest.scala b/scaladoc/test/dotty/tools/scaladoc/site/SiteGeneratationTest.scala index e012044156cc..4d558fe492c9 100644 --- a/scaladoc/test/dotty/tools/scaladoc/site/SiteGeneratationTest.scala +++ b/scaladoc/test/dotty/tools/scaladoc/site/SiteGeneratationTest.scala @@ -27,7 +27,7 @@ class SiteGeneratationTest extends BaseHtmlTest: content.assertTextsIn(".projectVersion", projectVersion) content.assertTextsIn("h1", header) content.assertTextsIn("title", title) - content.assertTextsIn(".breadcrumbs a", (parents :+ title):_*) + content.assertTextsIn(".breadcrumbs a", (parents :+ title)*) checks(content) } diff --git a/scaladoc/test/dotty/tools/scaladoc/tasty/comments/IntegrationTest.scala b/scaladoc/test/dotty/tools/scaladoc/tasty/comments/IntegrationTest.scala index 71f4b42f3320..690c4ba166f5 100644 --- a/scaladoc/test/dotty/tools/scaladoc/tasty/comments/IntegrationTest.scala +++ b/scaladoc/test/dotty/tools/scaladoc/tasty/comments/IntegrationTest.scala @@ -8,7 +8,7 @@ abstract class BaseIntegrationTest(pck: String) extends BaseHtmlTest: @Test def testLinks: Unit = withGeneratedDoc(pcks = Seq(pck, "commonlinks")) { def checkDocLinks(links: String*)(ctx: DocumentContext): Unit = - ctx.assertAttr(".documentableBrief a, .cover a", "href", links:_*) + ctx.assertAttr(".documentableBrief a, .cover a", "href", links*) ctx.assertNotExists("unresolvedLinkSelector") def checkUnresolved(ctx: DocumentContext): Unit = diff --git a/scaladoc/test/dotty/tools/scaladoc/tasty/comments/QueryParserTests.scala b/scaladoc/test/dotty/tools/scaladoc/tasty/comments/QueryParserTests.scala index 0d33a9363bac..103e95359714 100644 --- a/scaladoc/test/dotty/tools/scaladoc/tasty/comments/QueryParserTests.scala +++ b/scaladoc/test/dotty/tools/scaladoc/tasty/comments/QueryParserTests.scala @@ -13,8 +13,8 @@ class QueryParserTests { val head = shorthand.head val tail = shorthand.tail head match { - case ((id: String), ch) => Query.QualifiedId(Query.Qual.Id(id), ch, l2q(tail : _*)(last)) - case ((qual: Qual), ch) => Query.QualifiedId(qual, ch, l2q(tail : _*)(last)) + case ((id: String), ch) => Query.QualifiedId(Query.Qual.Id(id), ch, l2q(tail*)(last)) + case ((qual: Qual), ch) => Query.QualifiedId(qual, ch, l2q(tail*)(last)) } } } diff --git a/tests/explicit-nulls/neg/varargs.scala b/tests/explicit-nulls/neg/varargs.scala index cc27a4c9fb26..6a9b1db3e087 100644 --- a/tests/explicit-nulls/neg/varargs.scala +++ b/tests/explicit-nulls/neg/varargs.scala @@ -17,17 +17,17 @@ class Varargs { f1(null) // error f1("") f1("", null) // error - f1(null: _*) // error + f1(null*) // error - f1(xs1: _*) - f1(xs2: _*) // error - f1(xs3: _*) // error - f1(xs4: _*) // error + f1(xs1*) + f1(xs2*) // error + f1(xs3*) // error + f1(xs4*) // error - f1(ys1: _*) - f1(ys2: _*) // error - f1(ys3: _*) // error - f1(ys4: _*) // error + f1(ys1*) + f1(ys2*) // error + f1(ys3*) // error + f1(ys4*) // error } def test2 = { @@ -35,16 +35,16 @@ class Varargs { f2(null) f2("") f2("", null) - f2(null: _*) // error + f2(null*) // error - f2(xs1: _*) - f2(xs2: _*) - f2(xs3: _*) // error - f2(xs4: _*) // error + f2(xs1*) + f2(xs2*) + f2(xs3*) // error + f2(xs4*) // error - f2(ys1: _*) - f2(ys2: _*) - f2(ys3: _*) // error - f2(ys4: _*) // error + f2(ys1*) + f2(ys2*) + f2(ys3*) // error + f2(ys4*) // error } } \ No newline at end of file diff --git a/tests/explicit-nulls/unsafe-common/unsafe-java-varargs-src/S.scala b/tests/explicit-nulls/unsafe-common/unsafe-java-varargs-src/S.scala index e27b0dcaacbf..67fa583a7b66 100644 --- a/tests/explicit-nulls/unsafe-common/unsafe-java-varargs-src/S.scala +++ b/tests/explicit-nulls/unsafe-common/unsafe-java-varargs-src/S.scala @@ -12,8 +12,8 @@ class S { val arg3: Array[String] | Null = ??? val arg4: Array[String | Null] | Null = ??? - j.foo(arg1: _*) - j.foo(arg2: _*) - j.foo(arg3: _*) // error - j.foo(arg4: _*) // error + j.foo(arg1*) + j.foo(arg2*) + j.foo(arg3*) // error + j.foo(arg4*) // error } \ No newline at end of file diff --git a/tests/explicit-nulls/unsafe-common/unsafe-java-varargs.scala b/tests/explicit-nulls/unsafe-common/unsafe-java-varargs.scala index 8e61f5763391..9ec27cb090a1 100644 --- a/tests/explicit-nulls/unsafe-common/unsafe-java-varargs.scala +++ b/tests/explicit-nulls/unsafe-common/unsafe-java-varargs.scala @@ -24,15 +24,15 @@ def test2 = { val ys3: Array[String | Null] | Null = ??? val ys4: Array[String] | Null = ??? - Paths.get("", xs1: _*) - Paths.get("", xs2: _*) - Paths.get("", xs3: _*) // error - Paths.get("", xs4: _*) // error + Paths.get("", xs1*) + Paths.get("", xs2*) + Paths.get("", xs3*) // error + Paths.get("", xs4*) // error - Paths.get("", ys1: _*) - Paths.get("", ys2: _*) - Paths.get("", ys3: _*) // error - Paths.get("", ys4: _*) // error + Paths.get("", ys1*) + Paths.get("", ys2*) + Paths.get("", ys3*) // error + Paths.get("", ys4*) // error - Paths.get("", null: _*) // error + Paths.get("", null*) // error } \ No newline at end of file diff --git a/tests/neg/i6622d.scala b/tests/neg/i6622d.scala index ce4ff61d5187..2a1577f676ba 100644 --- a/tests/neg/i6622d.scala +++ b/tests/neg/i6622d.scala @@ -3,7 +3,7 @@ import scala.compiletime.* object Test { def main(args: Array[String]): Unit = { - println(StringContext("abc").code(Seq.empty[Any]:_*)) // error + println(StringContext("abc").code(Seq.empty[Any]*)) // error } } diff --git a/tests/neg/i6622e.scala b/tests/neg/i6622e.scala index 5b3e1bd2e913..b507788e3aca 100644 --- a/tests/neg/i6622e.scala +++ b/tests/neg/i6622e.scala @@ -3,7 +3,7 @@ import scala.compiletime.* object Test { def main(args: Array[String]): Unit = { - println(StringContext(Seq.empty[String]:_*).code(Seq.empty[Any]:_*)) // error + println(StringContext(Seq.empty[String]*).code(Seq.empty[Any]*)) // error } } diff --git a/tests/patmat/exhaustive_heuristics.scala b/tests/patmat/exhaustive_heuristics.scala index 7d682f6aa457..297900510b2a 100644 --- a/tests/patmat/exhaustive_heuristics.scala +++ b/tests/patmat/exhaustive_heuristics.scala @@ -18,8 +18,8 @@ object Test { // well, in truth, we do rewrite List() to Nil, but otherwise we do nothing // the full rewrite List(a, b) to a :: b :: Nil, for example is planned (but not sure it's a good idea) List(true, false) match { - case List(_, _, _:_*) => - case List(node, _:_*) => + case List(_, _, _*) => + case List(node, _*) => case Nil => } diff --git a/tests/pos-deep-subtype/i7580.scala b/tests/pos-deep-subtype/i7580.scala index 2e22da7fead9..ae0419da3e5c 100644 --- a/tests/pos-deep-subtype/i7580.scala +++ b/tests/pos-deep-subtype/i7580.scala @@ -1,5 +1,5 @@ def foo = - val List(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, _:_*) = List.fill(25)(0) + val List(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, _*) = List.fill(25)(0) () diff --git a/tests/pos-special/stdlib/collection/StringOps.scala b/tests/pos-special/stdlib/collection/StringOps.scala index f570531def98..0cff7bf50d16 100644 --- a/tests/pos-special/stdlib/collection/StringOps.scala +++ b/tests/pos-special/stdlib/collection/StringOps.scala @@ -862,7 +862,7 @@ final class StringOps(private val s: String) extends AnyVal { * @param groupNames The names of the groups in the pattern, in the order they appear. */ @deprecated("use inline group names like (?X) instead", "2.13.7") - def r(groupNames: String*): Regex = new Regex(s, groupNames: _*) + def r(groupNames: String*): Regex = new Regex(s, groupNames*) /** * @throws java.lang.IllegalArgumentException If the string does not contain a parsable `Boolean`. @@ -987,7 +987,7 @@ final class StringOps(private val s: String) extends AnyVal { * @throws java.lang.IllegalArgumentException */ def format(args : Any*): String = - java.lang.String.format(s, args map unwrapArg: _*) + java.lang.String.format(s, args map unwrapArg*) /** Like `format(args*)` but takes an initial `Locale` parameter * which influences formatting as in `java.lang.String`'s format. @@ -1003,7 +1003,7 @@ final class StringOps(private val s: String) extends AnyVal { * @throws java.lang.IllegalArgumentException */ def formatLocal(l: java.util.Locale, args: Any*): String = - java.lang.String.format(l, s, args map unwrapArg: _*) + java.lang.String.format(l, s, args map unwrapArg*) def compare(that: String): Int = s.compareTo(that) diff --git a/tests/pos-special/stdlib/collection/View.scala b/tests/pos-special/stdlib/collection/View.scala index 85910311a4c3..5e6644e139ec 100644 --- a/tests/pos-special/stdlib/collection/View.scala +++ b/tests/pos-special/stdlib/collection/View.scala @@ -80,7 +80,7 @@ object View extends IterableFactory[View] { def newBuilder[A]: Builder[A, View[A]] = ArrayBuffer.newBuilder[A].mapResult(from) - override def apply[A](xs: A*): View[A] = new Elems(xs: _*) + override def apply[A](xs: A*): View[A] = new Elems(xs*) /** The empty view */ @SerialVersionUID(3L) diff --git a/tests/pos/i13349.scala b/tests/pos/i13349.scala index e4048424db24..17cab7073c02 100644 --- a/tests/pos/i13349.scala +++ b/tests/pos/i13349.scala @@ -26,6 +26,6 @@ object Stream { def empty[A]: Stream[A] = Empty def apply[A](as: A*): Stream[A] = - if (as.isEmpty) empty else cons(as.head, apply(as.tail: _*)) + if (as.isEmpty) empty else cons(as.head, apply(as.tail*)) } diff --git a/tests/pos/i16105.scala b/tests/pos/i16105.scala index 477e47e98aa7..aa7d1954c874 100644 --- a/tests/pos/i16105.scala +++ b/tests/pos/i16105.scala @@ -6,7 +6,7 @@ trait QuerySQLSyntaxProvider[S <: SQLSyntaxSupport[A], A]{ } def include(syntaxProviders: QuerySQLSyntaxProvider[_, _]*) = { - syntax(syntaxProviders.map(_.resultName): _*) + syntax(syntaxProviders.map(_.resultName)*) } def syntax(resultNames: ResultNameSQLSyntaxProvider[_, _]*) = ??? \ No newline at end of file diff --git a/tests/pos/i16562.scala b/tests/pos/i16562.scala index 752028aae9a3..3ab87c0289b5 100644 --- a/tests/pos/i16562.scala +++ b/tests/pos/i16562.scala @@ -2,7 +2,7 @@ class Test: val a: Array[Any] = Array[Any]() val b: Array[Any] = Array[Any]() - def ko(p: Boolean): Unit = foo((if p then a else b): _*) - def ok(p: Boolean): Unit = foo({ val x = if p then a else b; x }: _*) + def ko(p: Boolean): Unit = foo((if p then a else b)*) + def ok(p: Boolean): Unit = foo({ val x = if p then a else b; x }*) def foo(in: Any*): Unit = () diff --git a/tests/pos/i4984.scala b/tests/pos/i4984.scala index f81f068113ed..04df1b62b3b0 100644 --- a/tests/pos/i4984.scala +++ b/tests/pos/i4984.scala @@ -17,10 +17,10 @@ class Test { } def test2(xs: Array[Int]): Seq[Int] = xs match { - case Array2(x, y, xs:_*) => xs + case Array2(x, y, xs*) => xs } def test3(xs: Array[Int]): Seq[Int] = xs match { - case Array2(xs:_*) => xs + case Array2(xs*) => xs } } diff --git a/tests/pos/i5039.scala b/tests/pos/i5039.scala index a14a6e812357..789db75f246d 100644 --- a/tests/pos/i5039.scala +++ b/tests/pos/i5039.scala @@ -1,5 +1,5 @@ class I0 { - List(null:_*) - List[Null](null:_*) - List[Nothing](null:_*) + List(null*) + List[Null](null*) + List[Nothing](null*) } diff --git a/tests/pos/i9050.scala b/tests/pos/i9050.scala index 4e9b9340eeab..3e295cc97956 100644 --- a/tests/pos/i9050.scala +++ b/tests/pos/i9050.scala @@ -3,5 +3,5 @@ object Foo { val foo = scala.collection.mutable.ArrayBuffer.empty[Seq[Double]] val bar = Seq.empty[Double] foo.append(bar) - foo.append(Seq(bar):_*) + foo.append(Seq(bar)*) } diff --git a/tests/pos/t0305.scala b/tests/pos/t0305.scala index 4838b1fcf867..50c45373eea1 100644 --- a/tests/pos/t0305.scala +++ b/tests/pos/t0305.scala @@ -3,5 +3,5 @@ object Test extends App { def foo(is:Int*) = 1; def foo(i:Int) = 2; - assert(foo( List(3):_* ) == 1) + assert(foo( List(3)* ) == 1) } diff --git a/tests/run-macros/f-interpolator-tests.scala b/tests/run-macros/f-interpolator-tests.scala index 8c59ae19a187..ba9dbb03777c 100755 --- a/tests/run-macros/f-interpolator-tests.scala +++ b/tests/run-macros/f-interpolator-tests.scala @@ -401,7 +401,7 @@ object StringContextTestUtils: // Use this String interpolator to avoid problems with a locale-dependent decimal mark. def locally(numbers: String*): String = val numbersWithCorrectLocale = numbers.map(applyProperLocale) - sc.s(numbersWithCorrectLocale: _*) + sc.s(numbersWithCorrectLocale*) // Handles cases like locally"3.14" - it's prettier than locally"${"3.14"}". def locally(): String = sc.parts.map(applyProperLocale).mkString diff --git a/tests/run-macros/refined-selectable-macro/Macro_2.scala b/tests/run-macros/refined-selectable-macro/Macro_2.scala index f25d42b7926d..fd553fd63896 100644 --- a/tests/run-macros/refined-selectable-macro/Macro_2.scala +++ b/tests/run-macros/refined-selectable-macro/Macro_2.scala @@ -17,7 +17,7 @@ object Macro2 { inline def apply[R <: Record](elems: (String, Any)*) : R = ${ applyImpl[R]('elems) } def applyImpl[R <: Record: Type](elems: Expr[Seq[(String, Any)]])(using Quotes) = { - '{ new Record($elems:_*).asInstanceOf[R] } + '{ new Record($elems*).asInstanceOf[R] } } def fromUntypedTuple(elems: (String, Any)*): Record = new Record(elems*) diff --git a/tests/run/i4984b.scala b/tests/run/i4984b.scala index 7f9beb62128c..c5184e0e49ce 100644 --- a/tests/run/i4984b.scala +++ b/tests/run/i4984b.scala @@ -17,11 +17,11 @@ object Test { } def test2(xs: Array[Int]): Seq[Int] = xs match { - case Array2(x, y, xs:_*) => xs + case Array2(x, y, xs*) => xs } def test3(xs: Array[Int]): Seq[Int] = xs match { - case Array2(xs:_*) => xs + case Array2(xs*) => xs } def main(args: Array[String]): Unit = { diff --git a/tests/run/i4984c.scala b/tests/run/i4984c.scala index cd23936ca209..437b642925cc 100644 --- a/tests/run/i4984c.scala +++ b/tests/run/i4984c.scala @@ -17,11 +17,11 @@ object Test { } def test2(xs: Array[Int]): Seq[Int] = xs match { - case Array2(x, y, xs:_*) => xs + case Array2(x, y, xs*) => xs } def test3(xs: Array[Int]): Seq[Int] = xs match { - case Array2(xs:_*) => xs + case Array2(xs*) => xs } def main(args: Array[String]): Unit = { diff --git a/tests/run/i4984d.scala b/tests/run/i4984d.scala index b53cc8585923..472ea21e99dc 100644 --- a/tests/run/i4984d.scala +++ b/tests/run/i4984d.scala @@ -20,11 +20,11 @@ object Test { } def test2(xs: Array[Int]): Seq[Int] = xs match { - case Array2(x, y, xs:_*) => xs + case Array2(x, y, xs*) => xs } def test3(xs: Array[Int]): Seq[Int] = xs match { - case Array2(xs:_*) => xs + case Array2(xs*) => xs } def main(args: Array[String]): Unit = { diff --git a/tests/run/i4984e.scala b/tests/run/i4984e.scala index dfc4727f08af..5a7d6d149112 100644 --- a/tests/run/i4984e.scala +++ b/tests/run/i4984e.scala @@ -21,11 +21,11 @@ object Test { } def test2(xs: Array[Int]): Seq[Int] = xs match { - case Array2(x, y, xs:_*) => xs + case Array2(x, y, xs*) => xs } def test3(xs: Array[Int]): Seq[Int] = xs match { - case Array2(xs:_*) => xs + case Array2(xs*) => xs } def main(args: Array[String]): Unit = { diff --git a/tests/run/i8977.scala b/tests/run/i8977.scala index 68e9835bd314..917801691c01 100644 --- a/tests/run/i8977.scala +++ b/tests/run/i8977.scala @@ -3,9 +3,9 @@ object Test { def main(args: Array[String]): Unit = { System.out.printf("pi = %6.4f\n", pi) - System.out.printf("pi = %6.4f\n", Seq[scala.Double](pi):_*) - System.out.printf("pi = %6.4f\n", Seq[java.lang.Double](pi):_*) - System.out.printf("pi = %6.4f\n", Array[scala.Double](pi):_*) - System.out.printf("pi = %6.4f\n", Array[java.lang.Double](pi):_*) + System.out.printf("pi = %6.4f\n", Seq[scala.Double](pi)*) + System.out.printf("pi = %6.4f\n", Seq[java.lang.Double](pi)*) + System.out.printf("pi = %6.4f\n", Array[scala.Double](pi)*) + System.out.printf("pi = %6.4f\n", Array[java.lang.Double](pi)*) } } diff --git a/tests/run/iterator-from.scala b/tests/run/iterator-from.scala index 4e1649fff7e8..ed689e289af0 100644 --- a/tests/run/iterator-from.scala +++ b/tests/run/iterator-from.scala @@ -56,13 +56,13 @@ object Test extends App { 0 until maxLength foreach {length => val keyValues = (0 until length map {_ => (R nextInt maxKey, R nextInt maxValue)}).toList val keys = keyValues map (_._2) - testSet(immutable.BitSet(keys:_*), keys) - testSet(immutable.TreeSet(keys:_*), keys) - testSet(mutable.TreeSet(keys:_*), keys) + testSet(immutable.BitSet(keys*), keys) + testSet(immutable.TreeSet(keys*), keys) + testSet(mutable.TreeSet(keys*), keys) val days = keys map {n => Weekday(n % Weekday.values.size)} - testSet(Weekday.ValueSet(days:_*), days) + testSet(Weekday.ValueSet(days*), days) - val treeMap = immutable.TreeMap(keyValues:_*) + val treeMap = immutable.TreeMap(keyValues*) testMap(treeMap, keyValues) testMap(treeMap.view.filterKeys(_ % 2 == 0).to(SortedMap), keyValues filter (_._1 % 2 == 0)) testMap(treeMap.view.mapValues(_ + 1).to(SortedMap), keyValues map {case (k,v) => (k, v + 1)}) diff --git a/tests/run/main-annotation-wrong-param-number.scala b/tests/run/main-annotation-wrong-param-number.scala index e607a85e4dc2..ea514db0c375 100644 --- a/tests/run/main-annotation-wrong-param-number.scala +++ b/tests/run/main-annotation-wrong-param-number.scala @@ -21,5 +21,5 @@ object Test: callMain(Array()) callMain(Array("1")) callMain(Array("1", "2", "3")) - callMain(Array((1 to 10).toArray.map(_.toString): _*)) + callMain(Array((1 to 10).toArray.map(_.toString)*)) end Test diff --git a/tests/run/mutable-treeset.scala b/tests/run/mutable-treeset.scala index 7af243482322..a281200a44b8 100644 --- a/tests/run/mutable-treeset.scala +++ b/tests/run/mutable-treeset.scala @@ -28,7 +28,7 @@ object Test extends App { } check(TreeSet[Int](), List[Int]()) - val set = TreeSet(list:_*) + val set = TreeSet(list*) check(set, distinct) check(set.clone, distinct) @@ -49,7 +49,7 @@ object Test extends App { assert(!(nonlist exists set.contains), s"$set had an element from $nonlist using contains") } - val set = TreeSet(list:_*) + val set = TreeSet(list*) check(set, list, nonlist) check(set.clone, list, nonlist) @@ -102,7 +102,7 @@ object Test extends App { assert(builtList.size == set.size, s"$set had size $set.size while $builtList had size $builtList.size") } } - val set = TreeSet(list:_*) + val set = TreeSet(list*) val clone = set.clone val subset = set.clone from (min + 1) until max val subclone = subset.clone diff --git a/tests/run/t2029.scala b/tests/run/t2029.scala index d4ab0f02b67f..d9cc14da6af2 100644 --- a/tests/run/t2029.scala +++ b/tests/run/t2029.scala @@ -2,10 +2,10 @@ object Test{ def main(args : Array[String]): Unit = { import scala.collection.immutable.TreeSet; - val mainSet = TreeSet(1 to 5 :_*) + val mainSet = TreeSet(1 to 5*) var compareCalled = false; - val smallerSet = TreeSet(2 to 4 :_*)(Ordering[Int].reverse) + val smallerSet = TreeSet(2 to 4*)(Ordering[Int].reverse) println(mainSet.mkString(",")) println(smallerSet.mkString(",")) diff --git a/tests/run/t3199b.scala b/tests/run/t3199b.scala index 8052ef996c70..e00ba595a4ee 100644 --- a/tests/run/t3199b.scala +++ b/tests/run/t3199b.scala @@ -1,7 +1,7 @@ object Test { def test() = { - java.util.Arrays.asList(Array(1,2,3):_*) + java.util.Arrays.asList(Array(1,2,3)*) } def main(args: Array[String]): Unit = { diff --git a/tests/run/trailingCommas.scala b/tests/run/trailingCommas.scala index 319737b0e299..738259aa91c5 100644 --- a/tests/run/trailingCommas.scala +++ b/tests/run/trailingCommas.scala @@ -1,5 +1,5 @@ object Test { - val List(x, y, z: _ *, + val List(x, y, z* ) = 42 :: 17 :: Nil def main(args: Array[String]): Unit = { Console.println(x)