LF: Drop wrong toArraySeq method from ImmArray. (#12163)

The method is not correctly implement, as it should slice the
underlying array before returning it. Since it is not possible to
implement it in constant time, we simply drop it, in favor in other
conversion.

CHANGELOG_BEGIN
CHANGELOG_END
This commit is contained in:
Remy 2021-12-16 11:18:52 +01:00 committed by GitHub
parent 101356ba36
commit 39ee326a51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,8 +12,7 @@ import scalaz.{Applicative, Equal, Foldable, Order, Traverse}
import scala.annotation.tailrec
import scala.collection.StrictOptimizedSeqFactory
import scala.collection.immutable.ArraySeq
import scala.collection.immutable.{AbstractSeq, IndexedSeqOps, StrictOptimizedSeqOps}
import scala.collection.immutable.{AbstractSeq, ArraySeq, IndexedSeqOps, StrictOptimizedSeqOps}
import scala.collection.mutable.Builder
import scala.reflect.ClassTag
@ -261,9 +260,7 @@ final class ImmArray[+A] private (
* return the `array` as is and people would be able to break the original
* `ImmArray`.
*/
def toSeq: ImmArray.ImmArraySeq[A] = new ImmArray.ImmArraySeq(this)
def toArraySeq: ArraySeq[A] = array
def toSeq: ImmArray.ImmArraySeq[A] = toIndexedSeq
/** O(n) */
def collect[B](f: PartialFunction[A, B]): ImmArray[B] = {