mirror of https://github.com/sbt/sbt.git
Merge pull request #8114 from xuwei-k/implicit-explicit-using-2
[2.x] add `using` if explicitly providing arguments to methods defined with `implicit`
This commit is contained in:
commit
01df2e0c0f
|
|
@ -37,7 +37,7 @@ private[sbt] object SbtRefactorings:
|
||||||
val split = SbtParser(FAKE_FILE, lines)
|
val split = SbtParser(FAKE_FILE, lines)
|
||||||
given ctx: Context = SbtParser.defaultGlobalForParser.compileCtx
|
given ctx: Context = SbtParser.defaultGlobalForParser.compileCtx
|
||||||
val recordedCommands = recordCommands(commands, split)
|
val recordedCommands = recordCommands(commands, split)
|
||||||
val sortedRecordedCommands = recordedCommands.sortBy(_._1)(reverseOrderingInt)
|
val sortedRecordedCommands = recordedCommands.sortBy(_._1)(using reverseOrderingInt)
|
||||||
|
|
||||||
val newContent = replaceFromBottomToTop(lines.mkString(END_OF_LINE), sortedRecordedCommands)
|
val newContent = replaceFromBottomToTop(lines.mkString(END_OF_LINE), sortedRecordedCommands)
|
||||||
newContent.linesIterator.toList
|
newContent.linesIterator.toList
|
||||||
|
|
|
||||||
|
|
@ -543,9 +543,7 @@ object Tests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sequence(results.toList, List()) map { res =>
|
sequence(results.toList, List()) map { res =>
|
||||||
val (rs, ms) = res.unzip { e =>
|
val (rs, ms) = res.unzip(using (e => (e.overall, e.events)))
|
||||||
(e.overall, e.events)
|
|
||||||
}
|
|
||||||
val m = ms reduce { (m1: Map[String, SuiteResult], m2: Map[String, SuiteResult]) =>
|
val m = ms reduce { (m1: Map[String, SuiteResult], m2: Map[String, SuiteResult]) =>
|
||||||
Map((m1.toSeq ++ m2.toSeq)*)
|
Map((m1.toSeq ++ m2.toSeq)*)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3551,9 +3551,9 @@ object Classpaths {
|
||||||
import sjsonnew.support.scalajson.unsafe.*
|
import sjsonnew.support.scalajson.unsafe.*
|
||||||
val moduleIdFormat: JsonFormat[ModuleID] = implicitly[JsonFormat[ModuleID]]
|
val moduleIdFormat: JsonFormat[ModuleID] = implicitly[JsonFormat[ModuleID]]
|
||||||
def write(key: ModuleID): String =
|
def write(key: ModuleID): String =
|
||||||
CompactPrinter(Converter.toJsonUnsafe(key)(moduleIdFormat))
|
CompactPrinter(Converter.toJsonUnsafe(key)(using moduleIdFormat))
|
||||||
def read(key: String): ModuleID =
|
def read(key: String): ModuleID =
|
||||||
Converter.fromJsonUnsafe[ModuleID](Parser.parseUnsafe(key))(moduleIdFormat)
|
Converter.fromJsonUnsafe[ModuleID](Parser.parseUnsafe(key))(using moduleIdFormat)
|
||||||
}
|
}
|
||||||
|
|
||||||
def classifiersModuleTask: Initialize[Task[GetClassifiersModule]] =
|
def classifiersModuleTask: Initialize[Task[GetClassifiersModule]] =
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ object RemoteCache {
|
||||||
import LibraryManagementCodec.*
|
import LibraryManagementCodec.*
|
||||||
import sjsonnew.support.scalajson.unsafe.*
|
import sjsonnew.support.scalajson.unsafe.*
|
||||||
val format: JsonFormat[Artifact] = summon[JsonFormat[Artifact]]
|
val format: JsonFormat[Artifact] = summon[JsonFormat[Artifact]]
|
||||||
CompactPrinter(Converter.toJsonUnsafe(art)(format))
|
CompactPrinter(Converter.toJsonUnsafe(art)(using format))
|
||||||
}
|
}
|
||||||
|
|
||||||
def gitCommitId: String =
|
def gitCommitId: String =
|
||||||
|
|
|
||||||
|
|
@ -242,9 +242,9 @@ private[sbt] object LibraryManagement {
|
||||||
import sjsonnew.support.scalajson.unsafe.*
|
import sjsonnew.support.scalajson.unsafe.*
|
||||||
val moduleIdFormat: JsonFormat[ModuleID] = implicitly[JsonFormat[ModuleID]]
|
val moduleIdFormat: JsonFormat[ModuleID] = implicitly[JsonFormat[ModuleID]]
|
||||||
def write(key: ModuleID): String =
|
def write(key: ModuleID): String =
|
||||||
CompactPrinter(Converter.toJsonUnsafe(key)(moduleIdFormat))
|
CompactPrinter(Converter.toJsonUnsafe(key)(using moduleIdFormat))
|
||||||
def read(key: String): ModuleID =
|
def read(key: String): ModuleID =
|
||||||
Converter.fromJsonUnsafe[ModuleID](Parser.parseUnsafe(key))(moduleIdFormat)
|
Converter.fromJsonUnsafe[ModuleID](Parser.parseUnsafe(key))(using moduleIdFormat)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -158,13 +158,13 @@ object FileStamp {
|
||||||
override def write[J](obj: Seq[(Path, FileStamp)], builder: Builder[J]): Unit = {
|
override def write[J](obj: Seq[(Path, FileStamp)], builder: Builder[J]): Unit = {
|
||||||
val (hashes, lastModifiedTimes) = obj.partition(_._2.isInstanceOf[Hash])
|
val (hashes, lastModifiedTimes) = obj.partition(_._2.isInstanceOf[Hash])
|
||||||
builder.beginObject()
|
builder.beginObject()
|
||||||
builder.addField("hashes", hashes.asInstanceOf[Seq[(Path, Hash)]])(
|
builder.addField("hashes", hashes.asInstanceOf[Seq[(Path, Hash)]])(using
|
||||||
seqPathHashJsonFormatter
|
seqPathHashJsonFormatter
|
||||||
)
|
)
|
||||||
builder.addField(
|
builder.addField(
|
||||||
"lastModifiedTimes",
|
"lastModifiedTimes",
|
||||||
lastModifiedTimes.asInstanceOf[Seq[(Path, LastModified)]]
|
lastModifiedTimes.asInstanceOf[Seq[(Path, LastModified)]]
|
||||||
)(seqPathLastModifiedJsonFormatter)
|
)(using seqPathLastModifiedJsonFormatter)
|
||||||
builder.endObject()
|
builder.endObject()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue