Skip to content

Commit

Permalink
Fix auto-tupling occurences (#2920)
Browse files Browse the repository at this point in the history
Pull request: #2920
  • Loading branch information
lefou authored Dec 13, 2023
1 parent 963b81d commit e4bcc27
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 16 deletions.
5 changes: 3 additions & 2 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
rules = [
RemoveUnused
]
RemoveUnused,
NoAutoTupling
]
2 changes: 1 addition & 1 deletion bsp/worker/src/mill/bsp/worker/MillScalaBuildServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private trait MillScalaBuildServer extends ScalaBuildServer { this: MillBuildSer
targetIds = _ => p.getTargets.asScala.toSeq,
tasks = {
case m: TestModule =>
T.task(Some(m.runClasspath(), m.testFramework(), m.compile()))
T.task(Some((m.runClasspath(), m.testFramework(), m.compile())))
case _ =>
T.task(None)
}
Expand Down
2 changes: 1 addition & 1 deletion build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ trait MillPublishJavaModule extends MillJavaModule with PublishModule {
trait MillScalaModule extends ScalaModule with MillJavaModule with ScalafixModule{ outer =>
def scalaVersion = Deps.scalaVersion
def scalacOptions =
super.scalacOptions() ++ Seq("-deprecation", "-P:acyclic:force", "-feature", "-Xlint:unused")
super.scalacOptions() ++ Seq("-deprecation", "-P:acyclic:force", "-feature", "-Xlint:unused", "-Xlint:adapted-args")

def testIvyDeps: T[Agg[Dep]] = Agg(Deps.utest)
def testModuleDeps: Seq[JavaModule] =
Expand Down
2 changes: 1 addition & 1 deletion main/eval/src/mill/eval/EvaluatorPaths.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object EvaluatorPaths {
new EvaluatorPaths(dest, meta, log)

private def unapply(evaluatorPaths: EvaluatorPaths): Option[(os.Path, os.Path, os.Path)] =
Option(evaluatorPaths.dest, evaluatorPaths.meta, evaluatorPaths.log)
Option((evaluatorPaths.dest, evaluatorPaths.meta, evaluatorPaths.log))

@internal
private[mill] def makeSegmentStrings(segments: Segments): Seq[String] = segments.value.flatMap {
Expand Down
2 changes: 1 addition & 1 deletion main/src/mill/main/RunScript.scala
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ object RunScript {
case t: mill.define.NamedTask[_] =>
val jsonFile = EvaluatorPaths.resolveDestPaths(evaluator.outPath, t).meta
val metadata = upickle.default.read[Evaluator.Cached](ujson.read(jsonFile.toIO))
Some(t.toString, metadata.value)
Some((t.toString, metadata.value))

case _ => None
}
Expand Down
2 changes: 1 addition & 1 deletion scalalib/src/mill/scalalib/JavaModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ trait JavaModule
def runBackgroundLogToConsole: Boolean = true

private def backgroundOutputs(dest: os.Path) =
if (runBackgroundLogToConsole) Some(os.Inherit, os.Inherit)
if (runBackgroundLogToConsole) Some((os.Inherit, os.Inherit))
else Jvm.defaultBackgroundOutputs(dest)

/**
Expand Down
8 changes: 4 additions & 4 deletions scalalib/src/mill/scalalib/dependency/versions/Version.scala
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private[dependency] object ReleaseVersion {
private[dependency] object PreReleaseVersion {
def unapply(v: Version): Option[(List[Long], List[String])] = v match {
case ValidVersion(_, releasePart, preReleasePart, Nil) if preReleasePart.nonEmpty =>
Some(releasePart, preReleasePart)
Some((releasePart, preReleasePart))
case _ => None
}
}
Expand All @@ -94,7 +94,7 @@ private[dependency] object PreReleaseBuildVersion {
v match {
case ValidVersion(_, releasePart, preReleasePart, buildPart)
if preReleasePart.nonEmpty && buildPart.nonEmpty =>
Some(releasePart, preReleasePart, buildPart)
Some((releasePart, preReleasePart, buildPart))
case _ => None
}
}
Expand All @@ -104,15 +104,15 @@ private[dependency] object SnapshotVersion {
v match {
case ValidVersion(_, releasePart, preReleasePart, buildPart)
if preReleasePart.lastOption.contains("SNAPSHOT") =>
Some(releasePart, preReleasePart, buildPart)
Some((releasePart, preReleasePart, buildPart))
case _ => None
}
}

private[dependency] object BuildVersion {
def unapply(v: Version): Option[(List[Long], List[String])] = v match {
case ValidVersion(_, releasePart, Nil, buildPart) if buildPart.nonEmpty =>
Some(releasePart, buildPart)
Some((releasePart, buildPart))
case _ => None
}
}
Expand Down
12 changes: 7 additions & 5 deletions testrunner/src/mill/testrunner/TestRunnerUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ import scala.jdk.CollectionConverters.IteratorHasAsScala
} else {
val zip = new ZipInputStream(new FileInputStream(base.toIO))
geny.Generator.selfClosing(
Iterator.continually(zip.getNextEntry)
.takeWhile(_ != null)
.map(_.getName)
.filter(_.endsWith(".class")),
() => zip.close()
(
Iterator.continually(zip.getNextEntry)
.takeWhile(_ != null)
.map(_.getName)
.filter(_.endsWith(".class")),
() => zip.close()
)
)
}
}
Expand Down

0 comments on commit e4bcc27

Please sign in to comment.