diff --git a/core/src/main/scala-3/cats/derived/DerivedEmpty.scala b/core/src/main/scala-3/cats/derived/DerivedEmpty.scala index 0175d536..7cc8d51b 100644 --- a/core/src/main/scala-3/cats/derived/DerivedEmpty.scala +++ b/core/src/main/scala-3/cats/derived/DerivedEmpty.scala @@ -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)) diff --git a/core/src/main/scala-3/cats/derived/DerivedEmptyK.scala b/core/src/main/scala-3/cats/derived/DerivedEmptyK.scala index 34c1da36..31c03134 100644 --- a/core/src/main/scala-3/cats/derived/DerivedEmptyK.scala +++ b/core/src/main/scala-3/cats/derived/DerivedEmptyK.scala @@ -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]] diff --git a/core/src/test/scala-3/cats/derived/EmptySuite.scala b/core/src/test/scala-3/cats/derived/EmptySuite.scala index d70bedf1..bff1b9c2 100644 --- a/core/src/test/scala-3/cats/derived/EmptySuite.scala +++ b/core/src/test/scala-3/cats/derived/EmptySuite.scala @@ -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 @@ -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.* diff --git a/core/src/test/scala-3/cats/derived/KittensSuite.scala b/core/src/test/scala-3/cats/derived/KittensSuite.scala index 7b2ad950..5fbd22f6 100644 --- a/core/src/test/scala-3/cats/derived/KittensSuite.scala +++ b/core/src/test/scala-3/cats/derived/KittensSuite.scala @@ -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")) diff --git a/core/src/test/scala-3/cats/derived/NonEmptyTraverseSuite.scala b/core/src/test/scala-3/cats/derived/NonEmptyTraverseSuite.scala index 9dc8347b..5c3fcb2e 100644 --- a/core/src/test/scala-3/cats/derived/NonEmptyTraverseSuite.scala +++ b/core/src/test/scala-3/cats/derived/NonEmptyTraverseSuite.scala @@ -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.* diff --git a/core/src/test/scala-3/cats/derived/PureSuite.scala b/core/src/test/scala-3/cats/derived/PureSuite.scala index 655b2ad9..de451c7f 100644 --- a/core/src/test/scala-3/cats/derived/PureSuite.scala +++ b/core/src/test/scala-3/cats/derived/PureSuite.scala @@ -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 diff --git a/core/src/test/scala-3/cats/derived/SemigroupSuite.scala b/core/src/test/scala-3/cats/derived/SemigroupSuite.scala index e56e2922..ecbff930 100644 --- a/core/src/test/scala-3/cats/derived/SemigroupSuite.scala +++ b/core/src/test/scala-3/cats/derived/SemigroupSuite.scala @@ -16,7 +16,7 @@ package cats.derived -import cats.{Eq, Semigroup} +import cats.Semigroup import cats.kernel.laws.discipline.* import org.scalacheck.Arbitrary diff --git a/core/src/test/scala-3/cats/derived/TraverseSuite.scala b/core/src/test/scala-3/cats/derived/TraverseSuite.scala index 01f2bea5..a5bcf3fe 100644 --- a/core/src/test/scala-3/cats/derived/TraverseSuite.scala +++ b/core/src/test/scala-3/cats/derived/TraverseSuite.scala @@ -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