Skip to content

Commit

Permalink
Changes to make MiMa happy
Browse files Browse the repository at this point in the history
  • Loading branch information
lrytz committed May 18, 2018
1 parent 2404f75 commit d999db4
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions doc/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -873,15 +873,15 @@ object CounterSpecification extends Commands {
* (a singleton [[Sut]]), implement this method the following way:
*
* {{{
* def canCreateNewSut(newState: State, initSuts: Iterable[State]
* runningSuts: Iterable[Sut]
* def canCreateNewSut(newState: State, initSuts: Traversable[State]
* runningSuts: Traversable[Sut]
* ) = {
* initSuts.isEmpty && runningSuts.isEmpty
* }
* }}}
*/
def canCreateNewSut(newState: State, initSuts: Iterable[State],
runningSuts: Iterable[Sut]): Boolean = true
def canCreateNewSut(newState: State, initSuts: Traversable[State],
runningSuts: Traversable[Sut]): Boolean = true

/** The precondition for the initial state, when no commands yet have
* run. This is used by ScalaCheck when command sequences are shrinked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ object LevelDBSpec extends Commands {
def path = s"db_$name"
}

def canCreateNewSut(newState: State, initSuts: Iterable[State],
runningSuts: Iterable[Sut]
def canCreateNewSut(newState: State, initSuts: Traversable[State],
runningSuts: Traversable[Sut]
) = {
!initSuts.exists(_.name == newState.name) &&
!runningSuts.exists(_.name == newState.name)
Expand Down
4 changes: 2 additions & 2 deletions examples/commands-nix/src/test/scala/CommandsNix.scala
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ object MachineSpec extends Commands {
type Sut = Map[String, org.libvirt.Domain]

// TODO we should check for example total amount of memory used here
def canCreateNewSut(newState: State, initSuts: Iterable[State],
runningSuts: Iterable[Sut]
def canCreateNewSut(newState: State, initSuts: Traversable[State],
runningSuts: Traversable[Sut]
): Boolean = true

def newSut(state: State): Sut = {
Expand Down
4 changes: 2 additions & 2 deletions examples/commands-redis/src/test/scala/CommandsRedis.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ object RedisSpec extends Commands {
connected: Boolean
)

def canCreateNewSut(newState: State, initSuts: Iterable[State],
runningSuts: Iterable[Sut]
def canCreateNewSut(newState: State, initSuts: Traversable[State],
runningSuts: Traversable[Sut]
): Boolean = {
initSuts.isEmpty && runningSuts.isEmpty
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ object CommandsSpecification extends Properties("Commands") {

override def shrinkState: Shrink[Int] = implicitly

def canCreateNewSut(newState: State, initSuts: Iterable[State],
runningSuts: Iterable[Sut]) = true
def canCreateNewSut(newState: State, initSuts: Traversable[State],
runningSuts: Traversable[Sut]) = true

def newSut(state: State): Sut = Counter(state)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private[scalacheck] trait GenVersionSpecific {
private[scalacheck] trait GenSpecificationVersionSpecific

private[scalacheck] trait CogenVersionSpecific {
implicit def cogenStream[A: Cogen]: Cogen[Stream[A]] =
implicit def cogenLazyList[A: Cogen]: Cogen[LazyList[A]] =
Cogen.it(_.iterator)
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/scala/org/scalacheck/Cogen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import scala.util.{Failure, Success, Try}
import scala.concurrent.duration.{Duration, FiniteDuration}
import java.math.BigInteger
import rng.Seed
import ScalaVersionSpecific._

sealed trait Cogen[T] extends Serializable {

Expand Down Expand Up @@ -124,7 +123,7 @@ object Cogen extends CogenArities with CogenLowPriority with CogenVersionSpecifi
implicit def cogenVector[A: Cogen]: Cogen[Vector[A]] =
Cogen.it(_.iterator)

implicit def cogenLazyList[A: Cogen]: Cogen[LazyList[A]] =
implicit def cogenStream[A: Cogen]: Cogen[Stream[A]] =
Cogen.it(_.iterator)

implicit def cogenSet[A: Cogen: Ordering]: Cogen[Set[A]] =
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/org/scalacheck/Gen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ object Gen extends GenArities with GenVersionSpecific {

/** Sequences generators. If any of the given generators fails, the
* resulting generator will also fail. */
def sequence[C,T](gs: Iterable[Gen[T]])(implicit b: Buildable[T,C]): Gen[C] = {
def sequence[C,T](gs: Traversable[Gen[T]])(implicit b: Buildable[T,C]): Gen[C] = {
val g = gen { (p, seed) =>
gs.foldLeft(r(Some(Vector.empty[T]), seed)) {
case (rs,g) =>
Expand Down
8 changes: 4 additions & 4 deletions src/main/scala/org/scalacheck/commands/Commands.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ trait Commands {
* (a singleton [[Sut]]), implement this method the following way:
*
* {{{
* def canCreateNewSut(newState: State, initSuts: Iterable[State]
* runningSuts: Iterable[Sut]
* def canCreateNewSut(newState: State, initSuts: Traversable[State]
* runningSuts: Traversable[Sut]
* ) = {
* initSuts.isEmpty && runningSuts.isEmpty
* }
* }}}
*/
def canCreateNewSut(newState: State, initSuts: Iterable[State],
runningSuts: Iterable[Sut]): Boolean
def canCreateNewSut(newState: State, initSuts: Traversable[State],
runningSuts: Traversable[Sut]): Boolean

/** Create a new [[Sut]] instance with an internal state that
* corresponds to the provided abstract state instance. The provided state
Expand Down
13 changes: 7 additions & 6 deletions src/main/scala/org/scalacheck/util/Buildable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import ScalaVersionSpecific._

trait Buildable[T,C] extends Serializable {
def builder: mutable.Builder[T,C]
def fromIterable(it: Iterable[T]): C = {
def fromIterable(it: Traversable[T]): C = {
val b = builder
b ++= it
b.result()
Expand All @@ -27,14 +27,15 @@ trait Buildable[T,C] extends Serializable {
* serializable too.
*/
object SerializableCanBuildFroms {
implicit def listFactory[T]: Factory[T, List[T]] = ScalaVersionSpecific.listFactory
implicit def bitsetFactory[T]: Factory[Int, BitSet] = ScalaVersionSpecific.bitsetFactory
implicit def mapFactory[T, U]: Factory[(T, U), Map[T, U]] = ScalaVersionSpecific.mapFactory
// Names are `..CanBuildFrom` for binary compatibility. Change to `..Factory` in a major release.
implicit def listCanBuildFrom[T]: Factory[T, List[T]] = ScalaVersionSpecific.listFactory
implicit def bitsetCanBuildFrom[T]: Factory[Int, BitSet] = ScalaVersionSpecific.bitsetFactory
implicit def mapCanBuildFrom[T, U]: Factory[(T, U), Map[T, U]] = ScalaVersionSpecific.mapFactory
}

object Buildable {

implicit def buildableFactory[T,C](implicit f: Factory[T,C]) =
// Names is `..CanBuildFrom` for binary compatibility. Change to `..Factory` in a major release.
implicit def buildableCanBuildFrom[T,C](implicit f: Factory[T,C]) =
new Buildable[T,C] {
def builder = f.newBuilder
}
Expand Down

0 comments on commit d999db4

Please sign in to comment.