diff --git a/scalacheck/src/main/scala-2/magnolify/scalacheck/ScalacheckMacros.scala b/scalacheck/src/main/scala-2/magnolify/scalacheck/ScalacheckMacros.scala index 5e97d5417..bfcb89516 100644 --- a/scalacheck/src/main/scala-2/magnolify/scalacheck/ScalacheckMacros.scala +++ b/scalacheck/src/main/scala-2/magnolify/scalacheck/ScalacheckMacros.scala @@ -20,13 +20,13 @@ import org.scalacheck.{Arbitrary, Cogen} import scala.reflect.macros.* object ScalaCheckMacros { - def genArbitraryMacro[T: c.WeakTypeTag](c: whitebox.Context): c.Tree = { + def autoDerivationArbitrary[T: c.WeakTypeTag](c: whitebox.Context): c.Tree = { import c.universe._ val wtt = weakTypeTag[T] q"""_root_.magnolify.scalacheck.ArbitraryDerivation.gen[$wtt]""" } - def genCogenMacro[T: c.WeakTypeTag](c: whitebox.Context): c.Tree = { + def autoDerivationCogen[T: c.WeakTypeTag](c: whitebox.Context): c.Tree = { import c.universe._ val wtt = weakTypeTag[T] q"""_root_.magnolify.scalacheck.CogenDerivation.gen[$wtt]""" @@ -35,6 +35,7 @@ object ScalaCheckMacros { } trait AutoDerivations { - implicit def genArbitrary[T]: Arbitrary[T] = macro ScalaCheckMacros.genArbitraryMacro[T] - implicit def genCogen[T]: Cogen[T] = macro ScalaCheckMacros.genCogenMacro[T] + implicit def autoDerivationArbitrary[T]: Arbitrary[T] = + macro ScalaCheckMacros.autoDerivationArbitrary[T] + implicit def autoDerivationCogen[T]: Cogen[T] = macro ScalaCheckMacros.autoDerivationCogen[T] } diff --git a/scalacheck/src/main/scala-3/magnolify/scalacheck/ScalacheckMacros.scala b/scalacheck/src/main/scala-3/magnolify/scalacheck/ScalacheckMacros.scala index 789fe7ca8..d699de7da 100644 --- a/scalacheck/src/main/scala-3/magnolify/scalacheck/ScalacheckMacros.scala +++ b/scalacheck/src/main/scala-3/magnolify/scalacheck/ScalacheckMacros.scala @@ -21,7 +21,7 @@ import org.scalacheck.{Arbitrary, Cogen} import scala.deriving.Mirror trait AutoDerivations: - inline implicit def genArbitrary[T](using Mirror.Of[T]): Arbitrary[T] = + inline implicit def autoDerivationArbitrary[T](using Mirror.Of[T]): Arbitrary[T] = ArbitraryDerivation.derivedMirror[T] - inline implicit def genCogen[T](using Mirror.Of[T]): Cogen[T] = + inline implicit def autoDerivationCogen[T](using Mirror.Of[T]): Cogen[T] = CogenDerivation.derivedMirror[T] diff --git a/scalacheck/src/main/scala/magnolify/scalacheck/semiauto/package.scala b/scalacheck/src/main/scala/magnolify/scalacheck/semiauto/package.scala index 49968882c..50cbf3028 100644 --- a/scalacheck/src/main/scala/magnolify/scalacheck/semiauto/package.scala +++ b/scalacheck/src/main/scala/magnolify/scalacheck/semiauto/package.scala @@ -25,8 +25,10 @@ package object semiauto { @deprecated("Use Gogen.gen[T] instead", "0.7.0") val CogenDerivation = magnolify.scalacheck.CogenDerivation - implicit def genArbitrary(a: Arbitrary.type): magnolify.scalacheck.ArbitraryDerivation.type = + implicit def semiautoDerivationArbitrary( + a: Arbitrary.type + ): magnolify.scalacheck.ArbitraryDerivation.type = magnolify.scalacheck.ArbitraryDerivation - implicit def genCogen(c: Cogen.type): magnolify.scalacheck.CogenDerivation.type = + implicit def semiautoDerivationCogen(c: Cogen.type): magnolify.scalacheck.CogenDerivation.type = magnolify.scalacheck.CogenDerivation } diff --git a/scalacheck/src/test/scala/magnolify/scalacheck/ArbitraryDerivationSuite.scala b/scalacheck/src/test/scala/magnolify/scalacheck/ArbitraryDerivationSuite.scala index 692fafafa..f2ebbb9ba 100644 --- a/scalacheck/src/test/scala/magnolify/scalacheck/ArbitraryDerivationSuite.scala +++ b/scalacheck/src/test/scala/magnolify/scalacheck/ArbitraryDerivationSuite.scala @@ -30,7 +30,7 @@ import scala.reflect._ class ArbitraryDerivationSuite extends MagnolifySuite { import TestArbitrary.arbSeed - import magnolify.scalacheck.auto.genArbitrary + import magnolify.scalacheck.auto.autoDerivationArbitrary private def test[T: ClassTag](implicit t: Arbitrary[T]): Unit = { // TODO val g = ensureSerializable(t).arbitrary @@ -73,8 +73,9 @@ class ArbitraryDerivationSuite extends MagnolifySuite { // magnolia scala3 limitation: // For a recursive structures it is required to assign the derived value to an implicit variable - implicit val arbNode: Arbitrary[Node] = genArbitrary - implicit val arbGNode: Arbitrary[GNode[Int]] = genArbitrary + import magnolify.scalacheck.semiauto.semiautoDerivationArbitrary + implicit val arbNode: Arbitrary[Node] = Arbitrary.gen + implicit val arbGNode: Arbitrary[GNode[Int]] = Arbitrary.gen test[Node] test[GNode[Int]] diff --git a/scalacheck/src/test/scala/magnolify/scalacheck/CogenDerivationSuite.scala b/scalacheck/src/test/scala/magnolify/scalacheck/CogenDerivationSuite.scala index e491eae68..73858da15 100644 --- a/scalacheck/src/test/scala/magnolify/scalacheck/CogenDerivationSuite.scala +++ b/scalacheck/src/test/scala/magnolify/scalacheck/CogenDerivationSuite.scala @@ -27,7 +27,7 @@ import scala.reflect.* class CogenDerivationSuite extends MagnolifySuite { import TestArbitrary.arbSeed - import magnolify.scalacheck.auto.genCogen + import magnolify.scalacheck.auto.autoDerivationCogen private def test[T: ClassTag](implicit arb: Arbitrary[T], t: Cogen[T]): Unit = { // TODO val co = ensureSerializable(t) @@ -60,8 +60,9 @@ class CogenDerivationSuite extends MagnolifySuite { // magnolia scala3 limitation: // For a recursive structures it is required to assign the derived value to an implicit variable - implicit val cogenNode: Cogen[Node] = genCogen - implicit val cogenGNode: Cogen[GNode[Int]] = genCogen + import magnolify.scalacheck.semiauto.semiautoDerivationCogen + implicit val cogenNode: Cogen[Node] = Cogen.gen + implicit val cogenGNode: Cogen[GNode[Int]] = Cogen.gen test[Node] test[GNode[Int]] diff --git a/scalacheck/src/test/scala/magnolify/scalacheck/FunctionDerivationSuite.scala b/scalacheck/src/test/scala/magnolify/scalacheck/FunctionDerivationSuite.scala index 6db978569..63cce1116 100644 --- a/scalacheck/src/test/scala/magnolify/scalacheck/FunctionDerivationSuite.scala +++ b/scalacheck/src/test/scala/magnolify/scalacheck/FunctionDerivationSuite.scala @@ -24,8 +24,7 @@ import org.scalacheck._ import scala.reflect._ class FunctionDerivationSuite extends MagnolifySuite { - import magnolify.scalacheck.auto.genCogen - import magnolify.scalacheck.auto.genArbitrary + import magnolify.scalacheck.auto._ private def test[A: ClassTag, B: ClassTag](implicit t: Arbitrary[A => B],