[2.0.x] Support given in build.sbt (#9432)

Co-authored-by: xuwei-k <6b656e6a69@gmail.com>
This commit is contained in:
eugene yokota 2026-07-11 14:30:27 -04:00 committed by GitHub
parent 35e99d27c1
commit 1125129bce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 2 deletions

View File

@ -350,8 +350,8 @@ object BuildUtilLite:
/** Prepend `_root_` and import just the names. */
def importNamesRoot(names: Seq[String]): Seq[String] = importNames(names map rootedName)
/** Wildcard import `._` for all values. */
def importAll(values: Seq[String]): Seq[String] = importNames(values map { _ + "._" })
/** Wildcard import `.{*, given}` for all values. */
def importAll(values: Seq[String]): Seq[String] = importNames(values map { _ + ".{*, given}" })
def importAllRoot(values: Seq[String]): Seq[String] = importAll(values map rootedName)
def rootedName(s: String): String = if (s contains '.') "_root_." + s else s
end BuildUtilLite

View File

@ -0,0 +1,9 @@
given Foo[Int] = Foo(2)
given s: Foo[String] = Foo("a")
InputKey[Unit]("check") := {
assert(summon[Foo[Int]].value == 2)
assert(summon[Foo[String]].value == "a")
assert(s.value == "a")
}

View File

@ -0,0 +1 @@
case class Foo[A](value: A)

View File

@ -0,0 +1 @@
> check