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

LF: Drop wrong toArraySeq method from ImmArray. #12163

Merged
merged 2 commits into from
Dec 16, 2021
Merged
Changes from 1 commit
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
Next Next commit
LF: Drop wrong toArraySeq method from ImmArray.
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
  • Loading branch information
remyhaemmerle-da committed Dec 16, 2021
commit fc53ad93153014819f6eb512799a53eee8d915fa
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ package com.daml.lf.data

import com.daml.scalautil.FoldableContravariant
import com.daml.scalautil.Statement.discard

import ScalazEqual.{equalBy, orderBy, toIterableForScalazInstances}
import scalaz.syntax.applicative._
import scalaz.{Applicative, Equal, Foldable, Order, Traverse}

import scala.annotation.tailrec
import scala.collection.StrictOptimizedSeqFactory
import scala.collection.{Factory, StrictOptimizedSeqFactory}
import scala.collection.immutable.ArraySeq
import scala.collection.immutable.{AbstractSeq, IndexedSeqOps, StrictOptimizedSeqOps}
import scala.collection.mutable.Builder
Expand Down Expand Up @@ -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] = {
Expand Down