Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scala 2.12.3 and 2.12.12 #3544

Merged
merged 1 commit into from
Aug 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jdk:
- openjdk8


scala_version_212: &scala_version_212 2.12.11
scala_version_213: &scala_version_213 2.13.2
scala_version_212: &scala_version_212 2.12.12
scala_version_213: &scala_version_213 2.13.3
dotty_version: &dotty_version 0.24.0

before_install:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import collection.Factory

abstract class IterableEmptyInstance {
implicit def iterableIsEmpty[CC[X] <: Iterable[X], A](implicit factory: Factory[A, CC[A]]): Empty[CC[A]] =
Empty(factory.newBuilder.result)
Empty(factory.newBuilder.result())
}
2 changes: 1 addition & 1 deletion alleycats-core/src/main/scala/alleycats/std/map.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ trait MapInstances {
else {
val n = idx.toInt
if (n >= fa.size) None
else Some(fa.valuesIterator.drop(n).next)
else Some(fa.valuesIterator.drop(n).next())
}

override def isEmpty[A](fa: Map[K, A]): Boolean = fa.isEmpty
Expand Down
4 changes: 2 additions & 2 deletions alleycats-core/src/main/scala/alleycats/std/set.scala
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ trait SetInstances {
@tailrec
def go(idx: Int, it: Iterator[A]): Option[A] =
if (it.hasNext) {
if (idx == 0) Some(it.next)
if (idx == 0) Some(it.next())
else {
it.next
it.next()
go(idx - 1, it)
}
} else None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MapSuite extends AlleycatsSuite {
val items = Map((0 until 100000).map { i => (i.toString, i) }: _*)
val sumAll = Traverse[Map[String, *]]
.traverse(items) { i => () => i }
.apply
.apply()
.values
.sum

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ abstract private[data] class OneAndLowPriority4 {
new Comonad[OneAnd[Stream, *]] {
def coflatMap[A, B](fa: OneAnd[Stream, A])(f: OneAnd[Stream, A] => B): OneAnd[Stream, B] = {
@tailrec def consume(as: Stream[A], buf: Builder[B, Stream[B]]): Stream[B] =
if (as.isEmpty) buf.result
if (as.isEmpty) buf.result()
else {
val tail = as.tail
consume(tail, buf += f(OneAnd(as.head, tail)))
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/scala-2.13+/cats/data/NonEmptyLazyList.scala
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ class NonEmptyLazyListOps[A](private val value: NonEmptyLazyList[A])
*/
final def reduceLeftTo[B](f: A => B)(g: (B, A) => B): B = {
val iter = toLazyList.iterator
var result = f(iter.next)
while (iter.hasNext) { result = g(result, iter.next) }
var result = f(iter.next())
while (iter.hasNext) { result = g(result, iter.next()) }
result
}

Expand All @@ -281,8 +281,8 @@ class NonEmptyLazyListOps[A](private val value: NonEmptyLazyList[A])
*/
final def reduceRightTo[B](f: A => B)(g: (A, B) => B): B = {
val iter = toLazyList.reverseIterator
var result = f(iter.next)
while (iter.hasNext) { result = g(iter.next, result) }
var result = f(iter.next())
while (iter.hasNext) { result = g(iter.next(), result) }
result
}

Expand Down Expand Up @@ -395,7 +395,7 @@ class NonEmptyLazyListOps[A](private val value: NonEmptyLazyList[A])
}

m.map {
case (k, v) => (k, create(v.result))
case (k, v) => (k, create(v.result()))
}: TreeMap[B, NonEmptyLazyList[A]]
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala-2.13+/cats/data/OneAndLowPriority4.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ abstract private[data] class OneAndLowPriority4 {
new Comonad[OneAnd[Stream, *]] {
def coflatMap[A, B](fa: OneAnd[Stream, A])(f: OneAnd[Stream, A] => B): OneAnd[Stream, B] = {
@tailrec def consume(as: Stream[A], buf: Builder[B, Stream[B]]): Stream[B] =
if (as.isEmpty) buf.result
if (as.isEmpty) buf.result()
else {
val tail = as.tail
consume(tail, buf += f(OneAnd(as.head, tail)))
Expand All @@ -29,7 +29,7 @@ abstract private[data] class OneAndLowPriority4 {
new Comonad[OneAnd[LazyList, *]] {
def coflatMap[A, B](fa: OneAnd[LazyList, A])(f: OneAnd[LazyList, A] => B): OneAnd[LazyList, B] = {
@tailrec def consume(as: LazyList[A], buf: Builder[B, LazyList[B]]): LazyList[B] =
if (as.isEmpty) buf.result
if (as.isEmpty) buf.result()
else {
val tail = as.tail
consume(tail, buf += f(OneAnd(as.head, tail)))
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala-2.13+/cats/instances/arraySeq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private[cats] object ArraySeqInstances {
case h :: tail if h.isEmpty =>
loop(state = tail)
case h :: tail =>
h.next match {
h.next() match {
case Right(b) =>
buf += b
loop(state)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala-2.13+/cats/instances/lazyList.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ trait LazyListInstances extends cats.kernel.instances.LazyListInstances {
val kernel = Iterator.unfold[Option[B], Iterator[Either[A, B]]](Iterator(Left(a))) { it =>
if (!it.hasNext) None
else
it.next match {
it.next() match {
case Left(a) => Some((None, fn(a).iterator ++ it))
case Right(b) => Some((Some(b), it))
}
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/scala/cats/Foldable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -774,13 +774,13 @@ import scala.annotation.implicitNotFound
val bld = List.newBuilder[A]
val it = xs.iterator
if (it.hasNext) {
bld += it.next
bld += it.next()
while (it.hasNext) {
bld += x
bld += it.next
bld += it.next()
}
}
bld.result
bld.result()
}

def compose[G[_]: Foldable]: Foldable[λ[α => F[G[α]]]] =
Expand Down Expand Up @@ -879,7 +879,7 @@ object Foldable {

def iterateRight[A, B](iterable: Iterable[A], lb: Eval[B])(f: (A, Eval[B]) => Eval[B]): Eval[B] = {
def loop(it: Iterator[A]): Eval[B] =
Eval.defer(if (it.hasNext) f(it.next, loop(it)) else lb)
Eval.defer(if (it.hasNext) f(it.next(), loop(it)) else lb)

Eval.always(iterable.iterator).flatMap(loop)
}
Expand Down
24 changes: 12 additions & 12 deletions core/src/main/scala/cats/data/Chain.scala
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ sealed abstract class Chain[+A] {
final def flatMap[B](f: A => Chain[B]): Chain[B] = {
var result = empty[B]
val iter = iterator
while (iter.hasNext) { result = result ++ f(iter.next) }
while (iter.hasNext) { result = result ++ f(iter.next()) }
result
}

Expand All @@ -158,7 +158,7 @@ sealed abstract class Chain[+A] {
final def foldLeft[B](z: B)(f: (B, A) => B): B = {
var result = z
val iter = iterator
while (iter.hasNext) { result = f(result, iter.next) }
while (iter.hasNext) { result = f(result, iter.next()) }
result
}

Expand Down Expand Up @@ -202,7 +202,7 @@ sealed abstract class Chain[+A] {
final def foldRight[B](z: B)(f: (A, B) => B): B = {
var result = z
val iter = reverseIterator
while (iter.hasNext) { result = f(iter.next, result) }
while (iter.hasNext) { result = f(iter.next(), result) }
result
}

Expand Down Expand Up @@ -347,7 +347,7 @@ sealed abstract class Chain[+A] {
val iter = iterator

while (iter.hasNext) {
val elem = iter.next
val elem = iter.next()
val k = f(elem)

m.get(k) match {
Expand Down Expand Up @@ -411,7 +411,7 @@ sealed abstract class Chain[+A] {
case Wrap(seq) =>
val iterator = seq.iterator
while (iterator.hasNext) {
val b = f(iterator.next)
val b = f(iterator.next())
if (b) return ()
}
c =
Expand Down Expand Up @@ -444,7 +444,7 @@ sealed abstract class Chain[+A] {
final def length: Long = {
val iter = iterator
var i: Long = 0
while (iter.hasNext) { i += 1; iter.next; }
while (iter.hasNext) { i += 1; iter.next(); }
i
}

Expand Down Expand Up @@ -479,7 +479,7 @@ sealed abstract class Chain[+A] {
val iterY = that.iterator
while (iterX.hasNext && iterY.hasNext) {
// scalastyle:off return
if (!A.eqv(iterX.next, iterY.next)) return false
if (!A.eqv(iterX.next(), iterY.next())) return false
// scalastyle:on return
}

Expand Down Expand Up @@ -515,7 +515,7 @@ sealed abstract class Chain[+A] {
()
}
builder += ')'
builder.result
builder.result()
}

def hash[AA >: A](implicit hashA: Hash[AA]): Int = StaticMethods.orderedHash((this: Chain[AA]).iterator)
Expand Down Expand Up @@ -761,7 +761,7 @@ object Chain extends ChainInstances {
else rights.reduceLeft((x, y) => Append(y, x))
rights.clear()
currentIterator = seq.iterator
currentIterator.next
currentIterator.next()
case null | Empty =>
throw new java.util.NoSuchElementException("next called on empty iterator")
}
Expand Down Expand Up @@ -804,7 +804,7 @@ object Chain extends ChainInstances {
else lefts.reduceLeft((x, y) => Append(x, y))
lefts.clear()
currentIterator = seq.reverseIterator
currentIterator.next
currentIterator.next()
case null | Empty =>
throw new java.util.NoSuchElementException("next called on empty iterator")
}
Expand Down Expand Up @@ -936,7 +936,7 @@ sealed abstract private[data] class ChainInstances extends ChainInstances1 {
val iterX = x.iterator
val iterY = y.iterator
while (iterX.hasNext && iterY.hasNext) {
val n = A0.compare(iterX.next, iterY.next)
val n = A0.compare(iterX.next(), iterY.next())
// scalastyle:off return
if (n != 0) return n
// scalastyle:on return
Expand Down Expand Up @@ -1006,7 +1006,7 @@ private[data] trait ChainPartialOrder[A] extends PartialOrder[Chain[A]] {
val iterX = x.iterator
val iterY = y.iterator
while (iterX.hasNext && iterY.hasNext) {
val n = A.partialCompare(iterX.next, iterY.next)
val n = A.partialCompare(iterX.next(), iterY.next())
// scalastyle:off return
if (n != 0.0) return n
// scalastyle:on return
Expand Down
16 changes: 8 additions & 8 deletions core/src/main/scala/cats/data/NonEmptyChain.scala
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ class NonEmptyChainOps[A](private val value: NonEmptyChain[A])
*/
final def reduceLeft(f: (A, A) => A): A = {
val iter = toChain.iterator
var result = iter.next
while (iter.hasNext) { result = f(result, iter.next) }
var result = iter.next()
while (iter.hasNext) { result = f(result, iter.next()) }
result
}

Expand All @@ -302,8 +302,8 @@ class NonEmptyChainOps[A](private val value: NonEmptyChain[A])
*/
final def reduceLeftTo[B](f: A => B)(g: (B, A) => B): B = {
val iter = toChain.iterator
var result = f(iter.next)
while (iter.hasNext) { result = g(result, iter.next) }
var result = f(iter.next())
while (iter.hasNext) { result = g(result, iter.next()) }
result
}

Expand All @@ -318,8 +318,8 @@ class NonEmptyChainOps[A](private val value: NonEmptyChain[A])
*/
final def reduceRight(f: (A, A) => A): A = {
val iter = toChain.reverseIterator
var result = iter.next
while (iter.hasNext) { result = f(result, iter.next) }
var result = iter.next()
while (iter.hasNext) { result = f(result, iter.next()) }
result
}

Expand All @@ -335,8 +335,8 @@ class NonEmptyChainOps[A](private val value: NonEmptyChain[A])
*/
final def reduceRightTo[B](f: A => B)(g: (A, B) => B): B = {
val iter = toChain.reverseIterator
var result = f(iter.next)
while (iter.hasNext) { result = g(iter.next, result) }
var result = f(iter.next())
while (iter.hasNext) { result = g(iter.next(), result) }
result
}

Expand Down
6 changes: 3 additions & 3 deletions core/src/main/scala/cats/data/NonEmptyList.scala
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,10 @@ final case class NonEmptyList[+A](head: A, tail: List[A]) extends NonEmptyCollec
var idx = 1
val it = tail.iterator
while (it.hasNext) {
bldr += ((it.next, idx))
bldr += ((it.next(), idx))
idx += 1
}
NonEmptyList((head, 0), bldr.result)
NonEmptyList((head, 0), bldr.result())
}

/**
Expand Down Expand Up @@ -390,7 +390,7 @@ final case class NonEmptyList[+A](head: A, tail: List[A]) extends NonEmptyCollec
}

m.map {
case (k, v) => (k, NonEmptyList.fromListUnsafe(v.result))
case (k, v) => (k, NonEmptyList.fromListUnsafe(v.result()))
}: TreeMap[B, NonEmptyList[A]]
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/cats/data/NonEmptyVector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ final class NonEmptyVector[+A] private (val toVector: Vector[A])
}

m.map {
case (k, v) => (k, NonEmptyVector.fromVectorUnsafe(v.result))
case (k, v) => (k, NonEmptyVector.fromVectorUnsafe(v.result()))
}: TreeMap[B, NonEmptyVector[A]]
}

Expand Down Expand Up @@ -507,7 +507,7 @@ object NonEmptyVector extends NonEmptyVectorInstances with Serializable {
val buf = Vector.newBuilder[A]
buf += head
tail.foreach(buf += _)
new NonEmptyVector(buf.result)
new NonEmptyVector(buf.result())
}

def one[A](head: A): NonEmptyVector[A] = apply(head, Vector.empty[A])
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/instances/list.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ trait ListInstances extends cats.kernel.instances.ListInstances {
case Nil => ()
}
go(f(a) :: Nil)
buf.result
buf.result()
}

def coflatMap[A, B](fa: List[A])(f: List[A] => B): List[B] = {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/instances/map.scala
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ trait MapInstances extends cats.kernel.instances.MapInstances {
}

f(a).foreach { case (k, a) => descend(k, a) }
bldr.result
bldr.result()
}

override def isEmpty[A](fa: Map[K, A]): Boolean = fa.isEmpty
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/scala/cats/instances/queue.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ trait QueueInstances extends cats.kernel.instances.QueueInstances {
}
}
case Nil =>
bldr.result
bldr.result()
}
go(f(a) :: Nil)
}

def coflatMap[A, B](fa: Queue[A])(f: Queue[A] => B): Queue[B] = {
val bldr = Queue.newBuilder[B]
@tailrec def loop(as: Queue[A]): Queue[B] =
if (as.isEmpty) bldr.result
if (as.isEmpty) bldr.result()
else {
val (_, rest) = as.dequeue
bldr += f(as)
Expand Down Expand Up @@ -89,7 +89,7 @@ trait QueueInstances extends cats.kernel.instances.QueueInstances {
override def mapWithIndex[A, B](fa: Queue[A])(f: (A, Int) => B): Queue[B] = {
val b = Queue.newBuilder[B]
fa.iterator.zipWithIndex.map(ai => f(ai._1, ai._2)).foreach(b += _)
b.result
b.result()
}

override def zipWithIndex[A](fa: Queue[A]): Queue[(A, Int)] =
Expand Down
Loading