typelevel/fs2

`Stream` created with `fromIterator` looping infinitely when evaluated in 3.10.x

JMdoubleU opened this issue · 3 comments

Maybe related? #3392

Yep, that's the cause:

scala> val i = Vector(1, 2).iterator
val i: Iterator[Int] = <iterator>

scala> i.take(5).toVector
val res0: Vector[Int] = Vector(1, 2)

scala> i.take(5).toVector
val res1: Vector[Int] = Vector(1, 2)

scala> i.take(5).toVector
val res2: Vector[Int] = Vector(1, 2)

Here's a fun one:

scala> val i = Vector(1, 2).iterator; i.take(5).toList; i.take(5).toList
val i: Iterator[Int] = <iterator>
val res0: List[Int] = List(1, 2)
val res1: List[Int] = List()

scala> val i = Vector(1, 2).iterator; i.take(5).toVector; i.take(5).toVector
val i: Iterator[Int] = <iterator>
val res2: Vector[Int] = Vector(1, 2)
val res3: Vector[Int] = Vector(1, 2)