From 39ee326a51b3bf201f7f57fd6c4260c65e028ab2 Mon Sep 17 00:00:00 2001 From: Remy Date: Thu, 16 Dec 2021 11:18:52 +0100 Subject: [PATCH] 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 --- .../scala/com/digitalasset/daml/lf/data/ImmArray.scala | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/daml-lf/data/src/main/scala/com/digitalasset/daml/lf/data/ImmArray.scala b/daml-lf/data/src/main/scala/com/digitalasset/daml/lf/data/ImmArray.scala index ab84f26ba2..2546ca6498 100644 --- a/daml-lf/data/src/main/scala/com/digitalasset/daml/lf/data/ImmArray.scala +++ b/daml-lf/data/src/main/scala/com/digitalasset/daml/lf/data/ImmArray.scala @@ -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] = {