Merge pull request #8111 from xuwei-k/implicit-explicit-using

[2.x] add `using` if explicitly providing arguments to methods defined with `implicit`
This commit is contained in:
eugene yokota 2025-05-09 02:28:24 -07:00 committed by GitHub
commit e59923dd5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 11 additions and 9 deletions

View File

@ -91,7 +91,7 @@ trait ContextUtil[C <: Quotes & scala.Singleton](val valStart: Int):
getAnnotation(tree) match
case Some(annot) =>
annot.asExprOf[cacheLevel] match
case '{ cacheLevel(include = Array.empty[CacheLevelTag]($_)) } => Nil
case '{ cacheLevel(include = Array.empty[CacheLevelTag](using $_)) } => Nil
case '{ cacheLevel(include = Array[CacheLevelTag]($include*)) } =>
include.value.get.toList
case _ => sys.error(Printer.TreeStructure.show(annot) + " does not match")

View File

@ -149,13 +149,15 @@ private[librarymanagement] abstract class ResolverFunctions {
MavenRepository("typesafe-" + status, TypesafeRepositoryRoot + "/" + status)
def typesafeIvyRepo(status: String) =
url("typesafe-ivy-" + status, new URI(TypesafeRepositoryRoot + "/ivy-" + status + "/").toURL)(
ivyStylePatterns
using ivyStylePatterns
)
def sbtIvyRepo(status: String) =
url(s"sbt-ivy-$status", new URI(s"$SbtRepositoryRoot/ivy-$status/").toURL)(ivyStylePatterns)
url(s"sbt-ivy-$status", new URI(s"$SbtRepositoryRoot/ivy-$status/").toURL)(using
ivyStylePatterns
)
def sbtPluginRepo(status: String) =
url("sbt-plugin-" + status, new URI(SbtRepositoryRoot + "/sbt-plugin-" + status + "/").toURL)(
ivyStylePatterns
using ivyStylePatterns
)
@deprecated(
"""Use sonatypeOssRepos instead e.g. `resolvers ++= Resolver.sonatypeOssRepos("snapshots")`""",
@ -177,7 +179,7 @@ private[librarymanagement] abstract class ResolverFunctions {
def bintrayRepo(owner: String, repo: String) =
MavenRepository(s"bintray-$owner-$repo", s"https://dl.bintray.com/$owner/$repo/")
def bintrayIvyRepo(owner: String, repo: String) =
url(s"bintray-$owner-$repo", new URI(s"https://dl.bintray.com/$owner/$repo/").toURL)(
url(s"bintray-$owner-$repo", new URI(s"https://dl.bintray.com/$owner/$repo/").toURL)(using
Resolver.ivyStylePatterns
)
def jcenterRepo = JCenterRepository

View File

@ -10,7 +10,7 @@ object ResolverTest extends UnitSpec {
val pats = Vector("[orgPath]")
val patsExpected = Vector("http://foo.com/test/[orgPath]")
val patterns = Resolver
.url("test", new URI("http://foo.com/test").toURL)(
.url("test", new URI("http://foo.com/test").toURL)(using
Patterns(
pats,
pats,

View File

@ -163,7 +163,7 @@ object ResolutionRun {
Task.point(Right(value))
}
retry(0, period).unsafeRun()(resolveTask.cache.ec)
retry(0, period).unsafeRun()(using resolveTask.cache.ec)
}
finalResult match {

View File

@ -26,9 +26,9 @@ trait UpdateOptionsFormat {
import sjsonnew.support.scalajson.unsafe.*
val moduleIdFormat: JsonFormat[ModuleID] = implicitly[JsonFormat[ModuleID]]
def write(key: ModuleID): String =
CompactPrinter(Converter.toJsonUnsafe(key)(moduleIdFormat))
CompactPrinter(Converter.toJsonUnsafe(key)(using moduleIdFormat))
def read(key: String): ModuleID =
Converter.fromJsonUnsafe[ModuleID](Parser.parseUnsafe(key))(moduleIdFormat)
Converter.fromJsonUnsafe[ModuleID](Parser.parseUnsafe(key))(using moduleIdFormat)
}
}