-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixing #309 * fixing compat with Scala 2
- Loading branch information
Showing
11 changed files
with
69 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 27 additions & 4 deletions
31
scalacheck/src/main/scala-3/pl/iterators/kebs/scalacheck/KebsScalacheckGenerators.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,32 @@ | ||
package pl.iterators.kebs.scalacheck | ||
|
||
import pl.iterators.kebs.scalacheck.macros.KebsScalacheckGeneratorsMacro | ||
import org.scalacheck.Arbitrary | ||
import scala.deriving.Mirror | ||
|
||
trait KebsScalacheckGenerators { | ||
inline implicit final def allGenerators[T](using inline m: Mirror.Of[T]): AllGenerators[T] = | ||
KebsScalacheckGeneratorsMacro.materializeGenerators[T] | ||
trait KebsScalacheckGenerators extends CommonArbitrarySupport { | ||
inline implicit final def allGenerators[T](using inline m: Mirror.Of[T]): AllGenerators[T] = { | ||
new AllGenerators[T] { | ||
|
||
override val minimal: Generator[T] = { | ||
import MinimalArbitrarySupport._ | ||
val arbitrary = summon[Arbitrary[T]] | ||
new Generator[T] { | ||
def ArbT: Arbitrary[T] = arbitrary | ||
} | ||
} | ||
override val maximal: Generator[T] = { | ||
import MaximalArbitrarySupport._ | ||
val arbitrary = summon[Arbitrary[T]] | ||
new Generator[T] { | ||
def ArbT: Arbitrary[T] = arbitrary | ||
} | ||
} | ||
override val normal: Generator[T] = { | ||
val arbitrary = summon[Arbitrary[T]] | ||
new Generator[T] { | ||
def ArbT: Arbitrary[T] = arbitrary | ||
} | ||
} | ||
} | ||
} | ||
} |
8 changes: 7 additions & 1 deletion
8
scalacheck/src/main/scala-3/pl/iterators/kebs/scalacheck/ScalacheckInstancesSupport.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
package pl.iterators.kebs.scalacheck | ||
|
||
trait ScalacheckInstancesSupport | ||
import org.scalacheck._ | ||
import io.github.martinhh.derived.scalacheck._ | ||
import scala.deriving.Mirror | ||
|
||
trait ScalacheckInstancesSupport { | ||
inline implicit def arb[T](using inline mirror: Mirror.Of[T]): Arbitrary[T] = deriveArbitrary[T] | ||
} |
44 changes: 0 additions & 44 deletions
44
.../src/main/scala-3/pl/iterators/kebs/scalacheck/macros/KebsScalacheckGeneratorsMacro.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters