Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump plugins #886

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ runner {
dialect = scala213
}

fileOverride {
"glob:**/github4s/shared/src/test/scala-3/**" {
runner.dialect = scala3
}
}

continuationIndent.callSite = 2

newlines {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ object ArbitraryDerivation { self =>
object semiauto:
extension (A: Arbitrary.type)
inline def derived[A]: Arbitrary[A] =
import auto.given
summonInline[Arbitrary[A]]

inline def deriveArb[A](using g: K0.Generic[A]): Arbitrary[A] =
Expand All @@ -26,20 +25,24 @@ object ArbitraryDerivation { self =>
// https://scastie.scala-lang.org/b8CXWfmXQUClqXplyA6TJg
opaque type DerivedGen[A] = Gen[A]
object DerivedGen extends DerivedGenInstances:
given [A]: Conversion[Gen[A], DerivedGen[A]] = identity
given [A]: Conversion[Gen[A], DerivedGen[A]] = identity
extension [A](gen: DerivedGen[A]) def arb: Arbitrary[A] = Arbitrary(gen)

private final class ArrayProduct(elems: Array[Any]) extends Product:
def canEqual(that: Any): Boolean = true
def productElement(n: Int): Any = elems(n)
def productArity: Int = elems.length
def canEqual(that: Any): Boolean = true
def productElement(n: Int): Any = elems(n)
def productArity: Int = elems.length
override def productIterator: Iterator[Any] = elems.iterator

def product[A](arbs: Seq[Arbitrary[_]])(using gen: K0.ProductGeneric[A]): DerivedGen[A] =
Gen.sequence[Array[Any], Any](arbs.map(_.arbitrary)).map(arr => gen.fromProduct(ArrayProduct(arr)).asInstanceOf[A])
Gen
.sequence[Array[Any], Any](arbs.map(_.arbitrary))
.map(arr => gen.fromProduct(ArrayProduct(arr)).asInstanceOf[A])

def coproduct[A](arbs: => IndexedSeq[Arbitrary[_ <: A]]): DerivedGen[A] =
Gen.lzy(if arbs.isEmpty then Gen.fail else Gen.choose(0, arbs.length - 1).flatMap(arbs(_).arbitrary))
Gen.lzy(
if arbs.isEmpty then Gen.fail else Gen.choose(0, arbs.length - 1).flatMap(arbs(_).arbitrary)
)

sealed abstract class DerivedGenInstances:
inline def summonAllArb[A, U](using gen: K0.Generic[A]): IndexedSeq[Arbitrary[_ <: U]] =
Expand Down
14 changes: 7 additions & 7 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12"
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.4.3")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.8")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.4.0")
addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-codecov" % "0.2.1")
addSbtPlugin("com.alejandrohdezma" % "sbt-github" % "0.11.6")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % "0.11.6")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-mdoc" % "0.11.6")
addSbtPlugin("com.alejandrohdezma" % "sbt-github" % "0.11.11")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % "0.11.11")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-mdoc" % "0.11.11")
addSbtPlugin("com.alejandrohdezma" % "sbt-remove-test-from-pom" % "0.1.0")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.2")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.4")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0")
Loading