diff --git a/.scalafmt.conf b/.scalafmt.conf index 6767c084ca..5401d30296 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,5 +1,5 @@ version = 3.8.3 -runner.dialect = scala213 +runner.dialect = scala3 project.git = true project.excludeFilters = [ /sbt-test/, /input_sources/, /contraband-scala/ ] @@ -27,12 +27,13 @@ danglingParentheses.defnSite = true rewrite.trailingCommas.style = keep rewrite.scala3.convertToNewSyntax = true +rewrite.scala3.newSyntax.control = false fileOverride { "glob:**/internal/compiler-bridge/**" { rewrite.scala3.convertToNewSyntax = false + runner.dialect = scala213 } } runner.dialectOverride.allowSignificantIndentation = false runner.dialectOverride.allowAsForImportRename = false runner.dialectOverride.allowStarWildcardImport = false -runner.dialectOverride.allowPostfixStarVarargSplices = false diff --git a/internal/zinc-apiinfo/src/test/scala/xsbt/api/ClassLikeHelpers.scala b/internal/zinc-apiinfo/src/test/scala/xsbt/api/ClassLikeHelpers.scala index cfd3a2f588..8f66e28d59 100644 --- a/internal/zinc-apiinfo/src/test/scala/xsbt/api/ClassLikeHelpers.scala +++ b/internal/zinc-apiinfo/src/test/scala/xsbt/api/ClassLikeHelpers.scala @@ -20,17 +20,17 @@ object ClassLikeHelpers { Structure.of(lzy(Array.empty[Type]), lzy(defs.toArray), emptyMembers) def simpleTrait(name: String, defs: List[ClassDefinition]): ClassLike = { - val structure = simpleStructure(defs: _*) + val structure = simpleStructure(defs*) simpleClassLike(name, structure, dt = DefinitionType.Trait) } def simpleClass(name: String, defs: ClassDefinition*): ClassLike = { - val structure = simpleStructure(defs: _*) + val structure = simpleStructure(defs*) simpleClassLike(name, structure) } def simpleObject(name: String, defs: ClassDefinition*): ClassLike = { - val structure = simpleStructure(defs: _*) + val structure = simpleStructure(defs*) simpleClassLike(name, structure, dt = DefinitionType.Module) } diff --git a/internal/zinc-classfile/src/main/scala/sbt/internal/inc/classfile/JavaAnalyze.scala b/internal/zinc-classfile/src/main/scala/sbt/internal/inc/classfile/JavaAnalyze.scala index 28eb16f4b4..892d7b1721 100644 --- a/internal/zinc-classfile/src/main/scala/sbt/internal/inc/classfile/JavaAnalyze.scala +++ b/internal/zinc-classfile/src/main/scala/sbt/internal/inc/classfile/JavaAnalyze.scala @@ -71,7 +71,7 @@ private[sbt] object JavaAnalyze { classFile val sourceToClassFiles = mutable.HashMap[VirtualFile, Buffer[ClassFile]]( - sources.map(vf => vf -> new ArrayBuffer[ClassFile]): _* + sources.map(vf => vf -> new ArrayBuffer[ClassFile])* ) val binaryClassNameToLoadedClass = new mutable.HashMap[String, Class[?]] diff --git a/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/JavaCompilerForUnitTesting.scala b/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/JavaCompilerForUnitTesting.scala index 1f61717d1d..779613d4ab 100644 --- a/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/JavaCompilerForUnitTesting.scala +++ b/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/JavaCompilerForUnitTesting.scala @@ -37,7 +37,7 @@ object JavaCompilerForUnitTesting { } def extractDependenciesFromSrcs(srcs: (String, String)*): ExtractedClassDependencies = { - val (_, testCallback) = compileJavaSrcs(srcs: _*)((_, _, classes) => extractParents(classes)) + val (_, testCallback) = compileJavaSrcs(srcs*)((_, _, classes) => extractParents(classes)) val memberRefDeps = testCallback.classDependencies .collect({ diff --git a/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ReflectUtilities.scala b/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ReflectUtilities.scala index 61f376182d..c98e040960 100644 --- a/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ReflectUtilities.scala +++ b/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ReflectUtilities.scala @@ -36,7 +36,7 @@ object ReflectUtilities { else clazz :: ancestry(clazz.getSuperclass); def fields(clazz: Class[?]) = - mutable.OpenHashMap(ancestry(clazz).flatMap(_.getDeclaredFields).map(f => (f.getName, f)): _*) + mutable.OpenHashMap(ancestry(clazz).flatMap(_.getDeclaredFields).map(f => (f.getName, f))*) /** * Collects all `val`s of type `T` defined on value `self`. diff --git a/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/AnalyzingCompiler.scala b/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/AnalyzingCompiler.scala index 735bc65ab2..2bc26682de 100644 --- a/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/AnalyzingCompiler.scala +++ b/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/AnalyzingCompiler.scala @@ -325,8 +325,8 @@ final class AnalyzingCompiler( private def invoke(bridge: AnyRef, bridgeClass: Class[?], methodName: String, log: Logger)( argTypes: Class[?]* )(args: AnyRef*): AnyRef = { - val method = bridgeClass.getMethod(methodName, argTypes: _*) - try method.invoke(bridge, args: _*) + val method = bridgeClass.getMethod(methodName, argTypes*) + try method.invoke(bridge, args*) catch { case e: InvocationTargetException => e.getCause match { diff --git a/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/CompilerArguments.scala b/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/CompilerArguments.scala index bfdc68c21b..8773d3b5a8 100644 --- a/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/CompilerArguments.scala +++ b/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/CompilerArguments.scala @@ -88,9 +88,9 @@ final class CompilerArguments( */ def finishClasspath(classpath: Seq[Path]): Seq[Path] = { val filteredClasspath = filterLibrary(classpath) - val extraCompiler = include(cpOptions.compiler, scalaInstance.compilerJars.map(_.toPath): _*) + val extraCompiler = include(cpOptions.compiler, scalaInstance.compilerJars.map(_.toPath)*) val otherJars = scalaInstance.otherJars.toList.map(_.toPath) - val extraClasspath = include(cpOptions.extra, otherJars: _*) + val extraClasspath = include(cpOptions.extra, otherJars*) filteredClasspath ++ extraCompiler ++ extraClasspath } diff --git a/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/javac/LocalJava.scala b/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/javac/LocalJava.scala index ff3f9f6594..f0dd3f8e06 100644 --- a/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/javac/LocalJava.scala +++ b/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/javac/LocalJava.scala @@ -129,7 +129,7 @@ object LocalJava { ): Int = javadocTool match { case Some(m) => - m.run(in, out, err, args: _*) + m.run(in, out, err, args*) case _ => System.err.println(JavadocFailure) -1 diff --git a/internal/zinc-core/src/main/scala/sbt/internal/inc/Stamp.scala b/internal/zinc-core/src/main/scala/sbt/internal/inc/Stamp.scala index 3efd1a2d0c..609c31b372 100644 --- a/internal/zinc-core/src/main/scala/sbt/internal/inc/Stamp.scala +++ b/internal/zinc-core/src/main/scala/sbt/internal/inc/Stamp.scala @@ -356,7 +356,7 @@ private class MStamps( val rs = removeSources.toSet Map(sources.toSeq.filter { case (file, stamp) => !rs(file) - }: _*) + }*) }, libraries.view.filterKeys(lib).toMap ) diff --git a/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/TextAnalysisFormat.scala b/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/TextAnalysisFormat.scala index 09ec21071d..2bb72a63bc 100644 --- a/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/TextAnalysisFormat.scala +++ b/internal/zinc-persist/src/main/scala/sbt/internal/inc/text/TextAnalysisFormat.scala @@ -287,7 +287,7 @@ class TextAnalysisFormat(val mappers: ReadWriteMappers) keyMapper: Mapper[File], valueMapper: ContextAwareMapper[File, Stamp] ): TreeMap[File, Stamp] = { - TreeMap(readMappedPairs(in)(expectedHeader, keyMapper.read, valueMapper.read).toSeq: _*) + TreeMap(readMappedPairs(in)(expectedHeader, keyMapper.read, valueMapper.read).toSeq*) } def doReadMapV( expectedHeader: String, @@ -295,7 +295,7 @@ class TextAnalysisFormat(val mappers: ReadWriteMappers) valueMapper: ContextAwareMapper[VirtualFileRef, Stamp] ): TreeMap[VirtualFileRef, Stamp] = { import VirtualFileUtil._ - TreeMap(readMappedPairs(in)(expectedHeader, keyMapper.read, valueMapper.read).toSeq: _*) + TreeMap(readMappedPairs(in)(expectedHeader, keyMapper.read, valueMapper.read).toSeq*) } val products = doReadMapV(Headers.products, productsMapper, productsStampsMapper) diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisGenerators.scala b/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisGenerators.scala index b47bc24c30..0fb6cdbc4e 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisGenerators.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisGenerators.scala @@ -79,7 +79,7 @@ object AnalysisGenerators { import VirtualFileUtil._ def stamp(xs: Iterable[VirtualFileRef]) = - for (stamps <- listOfN(xs.size, genStamp)) yield TreeMap(xs.toList.zip(stamps): _*) + for (stamps <- listOfN(xs.size, genStamp)) yield TreeMap(xs.toList.zip(stamps)*) for { prods <- stamp(rel.allProducts) diff --git a/zinc/src/main/scala/sbt/internal/inc/javac/AnalyzingJavaCompiler.scala b/zinc/src/main/scala/sbt/internal/inc/javac/AnalyzingJavaCompiler.scala index 6d0f3630f8..da62d88aca 100644 --- a/zinc/src/main/scala/sbt/internal/inc/javac/AnalyzingJavaCompiler.scala +++ b/zinc/src/main/scala/sbt/internal/inc/javac/AnalyzingJavaCompiler.scala @@ -208,7 +208,7 @@ final class AnalyzingJavaCompiler private[sbt] ( } { val classes = classFinder.classes try { - val newClasses = Set(classes.paths: _*) -- oldClasses + val newClasses = Set(classes.paths*) -- oldClasses JavaAnalyze(newClasses.toSeq, srcs, log, output, finalJarOutput)( callback, loader, diff --git a/zinc/src/test/scala/sbt/inc/IncrementalCompilerSpec.scala b/zinc/src/test/scala/sbt/inc/IncrementalCompilerSpec.scala index c812e68980..aeca3ee54f 100644 --- a/zinc/src/test/scala/sbt/inc/IncrementalCompilerSpec.scala +++ b/zinc/src/test/scala/sbt/inc/IncrementalCompilerSpec.scala @@ -194,7 +194,7 @@ class IncrementalCompilerSpec extends BaseCompilerSpec { ) ) } - comp.doCompileWithStore(newInputs = incrementalJavaInputs(sources: _*)) + comp.doCompileWithStore(newInputs = incrementalJavaInputs(sources*)) } val res1 = compileJava(f1, f2, f3) diff --git a/zinc/src/test/scala/sbt/inc/TestProjectSetup.scala b/zinc/src/test/scala/sbt/inc/TestProjectSetup.scala index 6710af83c2..ebe2f46052 100644 --- a/zinc/src/test/scala/sbt/inc/TestProjectSetup.scala +++ b/zinc/src/test/scala/sbt/inc/TestProjectSetup.scala @@ -126,8 +126,8 @@ case class CompilerSetup( } def compileBoth(sources: VirtualFile*) = { - val res = compile(sources: _*) - if (res.hasModified) compileAllJava(sources: _*) else res + val res = compile(sources*) + if (res.hasModified) compileAllJava(sources*) else res } def withSrcs(vs: Array[VirtualFile]) = (in: Inputs) => in.withOptions(in.options.withSources(vs))