Skip to content

Commit

Permalink
Merge pull request #475 from fthomas/topic/deprecate-util.Adjacent
Browse files Browse the repository at this point in the history
Deprecate scalacheck.util.Adjacent
  • Loading branch information
fthomas authored Apr 12, 2018
2 parents d560077 + 0a3ed83 commit ccce6bc
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 33 deletions.
11 changes: 10 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,16 @@ lazy val moduleJvmSettings = Def.settings(
ProblemFilters.exclude[ReversedMissingMethodProblem](
"eu.timepit.refined.NumericInference.lessEqualInference"),
ProblemFilters.exclude[ReversedMissingMethodProblem](
"eu.timepit.refined.scalacheck.StringInstances.stringSizeArbitrary")
"eu.timepit.refined.scalacheck.StringInstances.stringSizeArbitrary"),
ProblemFilters.exclude[IncompatibleMethTypeProblem](
"eu.timepit.refined.scalacheck.numeric.*"),
ProblemFilters.exclude[IncompatibleMethTypeProblem](
"eu.timepit.refined.scalacheck.NumericInstances.*"),
ProblemFilters.exclude[IncompatibleMethTypeProblem]("eu.timepit.refined.scalacheck.all.*"),
ProblemFilters.exclude[DirectMissingMethodProblem](
"eu.timepit.refined.scalacheck.NumericInstances.*"),
ProblemFilters.exclude[ReversedMissingMethodProblem](
"eu.timepit.refined.scalacheck.NumericInstances.*")
)
}
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package eu.timepit.refined.scalacheck

import eu.timepit.refined.api.{RefType, Validate}
import eu.timepit.refined.internal.Adjacent
import eu.timepit.refined.numeric._
import eu.timepit.refined.scalacheck.util.{Adjacent, Bounded}
import eu.timepit.refined.scalacheck.util.Bounded
import org.scalacheck.{Arbitrary, Gen}
import org.scalacheck.Gen.Choose
import shapeless.{Nat, Witness}
Expand Down Expand Up @@ -124,17 +125,17 @@ trait NumericInstances {
private def rangeOpenArbitrary[F[_, _]: RefType, T: Numeric: Choose, P](min: T, max: T)(
implicit at: Adjacent[T]
): Arbitrary[F[T, P]] =
arbitraryRefType(Gen.chooseNum(at.nextUpOrSelf(min), at.nextDownOrSelf(max)))
arbitraryRefType(Gen.chooseNum(at.nextUp(min), at.nextDown(max)))

private def rangeOpenClosedArbitrary[F[_, _]: RefType, T: Numeric: Choose, P](min: T, max: T)(
implicit at: Adjacent[T]
): Arbitrary[F[T, P]] =
arbitraryRefType(Gen.chooseNum(at.nextUpOrSelf(min), max))
arbitraryRefType(Gen.chooseNum(at.nextUp(min), max))

private def rangeClosedOpenArbitrary[F[_, _]: RefType, T: Numeric: Choose, P](min: T, max: T)(
implicit at: Adjacent[T]
): Arbitrary[F[T, P]] =
arbitraryRefType(Gen.chooseNum(min, at.nextDownOrSelf(max)))
arbitraryRefType(Gen.chooseNum(min, at.nextDown(max)))

private def rangeClosedArbitrary[F[_, _]: RefType, T: Numeric: Choose, P](
min: T,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package eu.timepit.refined.scalacheck.util

/**
* Auxiliary type class that provides the next smaller or next greater
* value for a given argument. This is needed for the `Arbitrary`
* instances of numeric refined types.
*/
@deprecated(
"This type class has been replaced by eu.timepit.refined.internal.Adjacent in the core module",
"0.9.0")
trait Adjacent[T] {
def nextUp(t: T): Option[T]

Expand Down

This file was deleted.

3 changes: 3 additions & 0 deletions notes/0.9.0.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
the `types.time` module. ([#425][#425])
* Remove deprecated `Refined#get` method which has been replaced by
`Refined#value`. ([#426][#426])
* Deprecate `scalacheck.util.Adjacent` in favor of `internal.Adjacent`
in the core module. ([#475][#475])

### Updates

Expand All @@ -46,4 +48,5 @@
[#434]: https://github.com/fthomas/refined/pull/434
[#438]: https://github.com/fthomas/refined/pull/438
[#467]: https://github.com/fthomas/refined/pull/467
[#475]: https://github.com/fthomas/refined/pull/475
[scala-dev/#446]: https://github.com/scala/scala-dev/issues/446

0 comments on commit ccce6bc

Please sign in to comment.