Skip to content

Commit

Permalink
Merge pull request #2940 from armanbilge/issue/2939
Browse files Browse the repository at this point in the history
Fix bincompat of `PartiallyAppliedFromIterator` on Scala 2.12
  • Loading branch information
mpilquist authored Jul 8, 2022
2 parents 3a72a4f + 10d4938 commit cb507e6
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2013 Functional Streams for Scala
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

package fs2

import cats.effect.kernel.Sync

private[fs2] trait PartiallyAppliedFromBlockingIteratorCrossCompat {
@deprecated("bincompat", "3.2.10")
private[fs2] def `apply$extension`[F[_], A](
dummy: Boolean,
iterator: Iterator[A],
chunkSize: Int,
F: Sync[F]
): Stream[F, A] =
new Stream.PartiallyAppliedFromIterator(dummy).apply(iterator, chunkSize)(F)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2013 Functional Streams for Scala
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

package fs2

private[fs2] trait PartiallyAppliedFromBlockingIteratorCrossCompat
6 changes: 4 additions & 2 deletions core/shared/src/main/scala/fs2/Stream.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3296,7 +3296,7 @@ object Stream extends StreamLowPriority {
def fromEither[F[_]]: PartiallyAppliedFromEither[F] =
new PartiallyAppliedFromEither(dummy = true)

private[fs2] final class PartiallyAppliedFromIterator[F[_]](
final class PartiallyAppliedFromIterator[F[_]] private[fs2] (
private val blocking: Boolean
) extends AnyVal {
def apply[A](iterator: Iterator[A], chunkSize: Int)(implicit F: Sync[F]): Stream[F, A] =
Expand All @@ -3318,7 +3318,9 @@ object Stream extends StreamLowPriority {
}
}

private[fs2] final class PartiallyAppliedFromBlockingIterator[F[_]](
object PartiallyAppliedFromIterator extends PartiallyAppliedFromBlockingIteratorCrossCompat

final class PartiallyAppliedFromBlockingIterator[F[_]] private[fs2] (
private val blocking: Boolean
) extends AnyVal {
def apply[A](iterator: Iterator[A], chunkSize: Int)(implicit F: Sync[F]): Stream[F, A] =
Expand Down

0 comments on commit cb507e6

Please sign in to comment.