Skip to content

Commit 5b7a677

Browse files
committed
Changes to compile with Scala 2.13.0-M4
Co-authored-by: julienrf
1 parent 0f46e16 commit 5b7a677

File tree

23 files changed

+169
-162
lines changed

23 files changed

+169
-162
lines changed

build.sbt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ lazy val isRelease = false
99
lazy val travisCommit = Option(System.getenv().get("TRAVIS_COMMIT"))
1010

1111
lazy val scalaVersionSettings = Seq(
12-
scalaVersion := "2.12.6",
13-
crossScalaVersions := Seq("2.10.7", "2.11.12", "2.13.0-M3", scalaVersion.value)
12+
scalaVersion := "2.13.0-M4",
13+
crossScalaVersions := Seq("2.10.7", "2.11.12", "2.13.0-M4", scalaVersion.value)
1414
)
1515

1616
lazy val sharedSettings = MimaSettings.settings ++ scalaVersionSettings ++ Seq(
@@ -56,7 +56,6 @@ lazy val sharedSettings = MimaSettings.settings ++ scalaVersionSettings ++ Seq(
5656
"-unchecked",
5757
"-Xfatal-warnings",
5858
"-Xfuture",
59-
"-Yno-adapted-args",
6059
"-Ywarn-dead-code",
6160
"-Ywarn-inaccessible",
6261
"-Ywarn-nullary-override",

doc/UserGuide.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -471,14 +471,14 @@ responsible for generating the individual items. You can use it in the
471471
following way:
472472

473473
```scala
474-
val genIntList = Gen.containerOf[List,Int](Gen.oneOf(1, 3, 5))
474+
val genIntList = Gen.containerOf[List,Int](Gen.oneOf(1, 3, 5))
475475

476-
val genStringStream = Gen.containerOf[Stream,String](Gen.alphaStr)
476+
val genStringLazyList = Gen.containerOf[LazyList,String](Gen.alphaStr)
477477

478-
val genBoolArray = Gen.containerOf[Array,Boolean](true)
478+
val genBoolArray = Gen.containerOf[Array,Boolean](true)
479479
```
480480

481-
By default, ScalaCheck supports generation of `List`, `Stream`, `Set`, `Array`,
481+
By default, ScalaCheck supports generation of `List`, `LazyList`, `Set`, `Array`,
482482
and `ArrayList` (from `java.util`). You can add support for additional
483483
containers by adding implicit `Buildable` instances. See `Buildable.scala` for
484484
examples.
@@ -778,7 +778,7 @@ can also define default shrinking methods. This is done by defining an implicit
778778
method that returns a `Shrink[T]` instance. This is done by using the
779779
`Shrink(...)` factory method, which as its only parameter takes a function and
780780
returns an instance of `Shrink[T]`. In turn, the function should take a value
781-
of the given type `T`, and return a `Stream` of shrank variants of the given
781+
of the given type `T`, and return a `LazyList` of shrank variants of the given
782782
value. As an example, look at the implicit `Shrink` instance for a tuple as it
783783
is defined in ScalaCheck:
784784

@@ -873,15 +873,15 @@ object CounterSpecification extends Commands {
873873
* (a singleton [[Sut]]), implement this method the following way:
874874
*
875875
* {{{
876-
* def canCreateNewSut(newState: State, initSuts: Traversable[State]
877-
* runningSuts: Traversable[Sut]
876+
* def canCreateNewSut(newState: State, initSuts: Iterable[State]
877+
* runningSuts: Iterable[Sut]
878878
* ) = {
879879
* initSuts.isEmpty && runningSuts.isEmpty
880880
* }
881881
* }}}
882882
*/
883-
def canCreateNewSut(newState: State, initSuts: Traversable[State],
884-
runningSuts: Traversable[Sut]): Boolean = true
883+
def canCreateNewSut(newState: State, initSuts: Iterable[State],
884+
runningSuts: Iterable[Sut]): Boolean = true
885885

886886
/** The precondition for the initial state, when no commands yet have
887887
* run. This is used by ScalaCheck when command sequences are shrinked

examples/commands-leveldb/src/test/scala/CommandsLevelDB.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ object LevelDBSpec extends Commands {
3030
def path = s"db_$name"
3131
}
3232

33-
def canCreateNewSut(newState: State, initSuts: Traversable[State],
34-
runningSuts: Traversable[Sut]
33+
def canCreateNewSut(newState: State, initSuts: Iterable[State],
34+
runningSuts: Iterable[Sut]
3535
) = {
3636
!initSuts.exists(_.name == newState.name) &&
3737
!runningSuts.exists(_.name == newState.name)

examples/commands-nix/src/test/scala/CommandsNix.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ object MachineSpec extends Commands {
100100
type Sut = Map[String, org.libvirt.Domain]
101101

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

107107
def newSut(state: State): Sut = {

examples/commands-redis/src/test/scala/CommandsRedis.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ object RedisSpec extends Commands {
2626
connected: Boolean
2727
)
2828

29-
def canCreateNewSut(newState: State, initSuts: Traversable[State],
30-
runningSuts: Traversable[Sut]
29+
def canCreateNewSut(newState: State, initSuts: Iterable[State],
30+
runningSuts: Iterable[Sut]
3131
): Boolean = {
3232
initSuts.isEmpty && runningSuts.isEmpty
3333
}

jvm/src/test/scala/org/scalacheck/CogenSpecification.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ object CogenSpecification extends Properties("Cogen") {
140140
include(cogenLaws[String], "cogenString.")
141141
include(cogenLaws[List[Int]], "cogenList.")
142142
include(cogenLaws[Vector[Int]], "cogenVector.")
143-
include(cogenLaws[Stream[Int]], "cogenStream.")
143+
include(cogenLaws[LazyList[Int]], "cogenLazyList.")
144144
include(cogenLaws[Set[Int]], "cogenSet.")
145145
include(cogenLaws[Map[Int, Int]], "cogenMap.")
146146
include(cogenLaws[() => Int], "cogenFunction0.")

jvm/src/test/scala/org/scalacheck/GenSpecification.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ object GenSpecification extends Properties("Gen") {
179179
l.length == 0
180180
}
181181

182-
property("infiniteStream") = forAll(infiniteStream(arbitrary[Int]), arbitrary[Short]) { (s, n) =>
182+
property("infiniteLazyList") = forAll(infiniteLazyList(arbitrary[Int]), arbitrary[Short]) { (s, n) =>
183183
s.drop(n & 0xffff).nonEmpty
184184
}
185185

@@ -201,7 +201,7 @@ object GenSpecification extends Properties("Gen") {
201201
property("distributed pick") = {
202202
val lst = (0 to 7).toIterable
203203
val n = 2
204-
forAll(pick(n, lst)) { xs: Seq[Int] =>
204+
forAll(pick(n, lst)) { xs: collection.Seq[Int] =>
205205
xs.map { x: Int =>
206206
Prop.collect(x) {
207207
xs.size == n

jvm/src/test/scala/org/scalacheck/PropertyFilterSpecification.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ object PropertyFilterSpecification extends Properties("PropertyFilter") {
2626

2727
val nl = System.lineSeparator
2828

29-
private def diff(filter: Option[String], actual: Seq[String],
30-
expected: Seq[String]): String = {
29+
private def diff(filter: Option[String], actual: collection.Seq[String],
30+
expected: collection.Seq[String]): String = {
3131
s"filter: ${filter.getOrElse("not supplied")}" +
3232
s"${nl}expected values:$nl" +
3333
s"\t${expected.mkString(s"$nl\t")}" +
3434
s"${nl}actual values:$nl" +
3535
s"\t${actual.mkString(s"$nl\t")}"
3636
}
3737

38-
private def prop(filter: Option[String], actualNames: Seq[String],
39-
expectedNames: Seq[String]): Prop = {
38+
private def prop(filter: Option[String], actualNames: collection.Seq[String],
39+
expectedNames: collection.Seq[String]): Prop = {
4040
def lengthProp = actualNames.length == expectedNames.length
4141

4242
def props = actualNames.forall(expectedNames.contains)

jvm/src/test/scala/org/scalacheck/commands/CommandsSpecification.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ object CommandsSpecification extends Properties("Commands") {
3030

3131
override def shrinkState: Shrink[Int] = implicitly
3232

33-
def canCreateNewSut(newState: State, initSuts: Traversable[State],
34-
runningSuts: Traversable[Sut]) = true
33+
def canCreateNewSut(newState: State, initSuts: Iterable[State],
34+
runningSuts: Iterable[Sut]) = true
3535

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

src/main/scala/org/scalacheck/Arbitrary.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,22 +357,22 @@ private[scalacheck] sealed trait ArbitraryLowPriority {
357357
Arbitrary(Gen.oneOf(arbitrary[T].map(Success(_)), arbitrary[Throwable].map(Failure(_))))
358358

359359
/** Arbitrary instance of any [[org.scalacheck.util.Buildable]] container
360-
* (such as lists, arrays, streams, etc). The maximum size of the container
360+
* (such as lists, arrays, lazy lists, etc). The maximum size of the container
361361
* depends on the size generation parameter. */
362362
implicit def arbContainer[C[_],T](implicit
363-
a: Arbitrary[T], b: Buildable[T,C[T]], t: C[T] => Traversable[T]
363+
a: Arbitrary[T], b: Buildable[T,C[T]], t: C[T] => Iterable[T]
364364
): Arbitrary[C[T]] = Arbitrary(buildableOf[C[T],T](arbitrary[T]))
365365

366366
/** Arbitrary instance of any [[org.scalacheck.util.Buildable]] container
367367
* (such as maps). The maximum size of the container depends on the size
368368
* generation parameter. */
369369
implicit def arbContainer2[C[_,_],T,U](implicit
370-
a: Arbitrary[(T,U)], b: Buildable[(T,U),C[T,U]], t: C[T,U] => Traversable[(T,U)]
370+
a: Arbitrary[(T,U)], b: Buildable[(T,U),C[T,U]], t: C[T,U] => Iterable[(T,U)]
371371
): Arbitrary[C[T,U]] = Arbitrary(buildableOf[C[T,U],(T,U)](arbitrary[(T,U)]))
372372

373373
implicit def arbEnum[A <: java.lang.Enum[A]](implicit A: reflect.ClassTag[A]): Arbitrary[A] = {
374374
val values = A.runtimeClass.getEnumConstants.asInstanceOf[Array[A]]
375-
Arbitrary(Gen.oneOf(values))
375+
Arbitrary(Gen.oneOf(values.toIndexedSeq))
376376
}
377377

378378
implicit def arbPartialFunction[A: Cogen, B: Arbitrary]: Arbitrary[PartialFunction[A, B]] =

0 commit comments

Comments
 (0)