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

Update scala3-library, ... to 3.3.4 #686

Merged
merged 2 commits into from
Sep 27, 2024
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
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import sbt.*

val scala212 = "2.12.20"
val scala213 = "2.13.15"
val scala3 = "3.3.3"
val scala3 = "3.3.4"

ThisBuild / crossScalaVersions := Seq(scala212, scala213, scala3)
ThisBuild / scalaVersion := scala3
Expand Down
1 change: 1 addition & 0 deletions core/src/main/scala-3/cats/derived/DerivedEmpty.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ object DerivedEmpty:
given product[A: ProductInstancesOf[Empty]]: DerivedEmpty[A] =
Empty(ProductInstances.construct([a] => (A: Empty[a]) => A.empty))

@nowarn("id=E197")
inline given coproduct[A: CoproductGeneric]: DerivedEmpty[A] =
Empty(CoproductGeneric.withOnly[DerivedEmpty.Or, A]([a <: A] => (A: DerivedEmpty.Or[a]) => A.unify.empty))
1 change: 1 addition & 0 deletions core/src/main/scala-3/cats/derived/DerivedEmptyK.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ object DerivedEmptyK:
given product[F[_]: ProductInstancesOf[EmptyK]]: DerivedEmptyK[F] = new EmptyK[F]:
def empty[A]: F[A] = ProductInstances.construct([f[_]] => (F: EmptyK[f]) => F.empty[A])

@nowarn("id=E197")
inline given coproduct[F[_]: CoproductGeneric]: DerivedEmptyK[F] =
CoproductGeneric.withOnly[DerivedEmptyK.Or, EmptyK[F]]:
[f[x] <: F[x]] => (F: DerivedEmptyK.Or[f]) => F.unify.asInstanceOf[EmptyK[F]]
10 changes: 5 additions & 5 deletions core/src/test/scala-3/cats/derived/EmptySuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ class EmptySuite extends KittensSuite:
locally:
import auto.empty.given
validate("auto.empty")
testNoInstance("Empty", "IList[Int]")
testNoInstance("Empty", "Snoc[Int]")
testNoInstance("Empty", "Rgb")
testNoGiven("Empty[IList[Int]]", "alleycats.Empty")
testNoGiven("Empty[Snoc[Int]]", "alleycats.Empty")
testNoGiven("Empty[Rgb]", "alleycats.Empty")

locally:
import semiInstances.given
Expand All @@ -58,8 +58,8 @@ class EmptySuite extends KittensSuite:
testNoInstance("strict.semiauto.empty", "Rgb")
testNoInstance("strict.semiauto.empty", "Top")
test("No strict.semiauto.empty for IList[Int] or Snoc[Int]"):
assertNoInstance(compileErrors("given Empty[IList[Int]] = strict.semiauto.empty"))
assertNoInstance(compileErrors("given Empty[Snoc[Int]] = strict.semiauto.empty"))
testNoGiven("given Empty[IList[Int]] = strict.semiauto.empty", "alleycats.Empty")
testNoGiven("given Empty[Snoc[Int]] = strict.semiauto.empty", "alleycats.Empty")

locally:
import derivedInstances.*
Expand Down
11 changes: 6 additions & 5 deletions core/src/test/scala-3/cats/derived/KittensSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ object KittensSuite:
given [A <: Product](using mirror: Mirror.ProductOf[A], via: Cogen[mirror.MirroredElemTypes]): Cogen[A] =
via.contramap(Tuple.fromProductTyped)

def assertNoInstance(errors: String): Unit =
val message = "No given instance of type"
assert(errors.contains(message), s"$errors did not contain $message")
inline def testNoInstance(inline tc: String, inline target: String): Unit =
val tcName = tc.drop(tc.lastIndexOf('.') + 1).capitalize
testNoGiven(tc + "[" + target + "]", s"Could not derive $tcName for")

inline def testNoInstance(inline tc: String, target: String): Unit =
test(s"No $tc for $target")(assertNoInstance(compileErrors(tc + "[" + target + "]")))
inline def testNoGiven(inline code: String, message: String): Unit =
val errors = compileErrors(code)
test(s"No given $code")(assert(errors.contains(message), s"$errors did not contain $message"))
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package cats.derived

import cats.{Eq, NonEmptyTraverse, Traverse}
import cats.{NonEmptyTraverse, Traverse}
import cats.data.{NonEmptyList, OneAnd}
import cats.derived.Derived.<<<
import cats.laws.discipline.*
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/scala-3/cats/derived/PureSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class PureSuite extends KittensSuite:
locally:
import auto.pure.given
validate("auto.pure")
testNoInstance("Pure", "IList")
testNoInstance("Pure", "Snoc")
testNoGiven("Pure[IList]", "No given instance of type alleycats.Pure")
testNoGiven("Pure[Snoc]", "No given instance of type alleycats.Pure")

locally:
import semiInstances.given
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/scala-3/cats/derived/SemigroupSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package cats.derived

import cats.{Eq, Semigroup}
import cats.Semigroup
import cats.kernel.laws.discipline.*
import org.scalacheck.Arbitrary

Expand Down
2 changes: 1 addition & 1 deletion core/src/test/scala-3/cats/derived/TraverseSuite.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cats.derived

import cats.derived.Derived.<<<
import cats.{Eq, Traverse}
import cats.Traverse
import cats.laws.discipline.*
import shapeless3.deriving.Const

Expand Down