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

Revert "VectorBuilder avoids copying data if possible" #8410

Merged
merged 1 commit into from Sep 12, 2019

Conversation

szeiger
Copy link
Member

@szeiger szeiger commented Sep 10, 2019

This reverts commit 18224fd.

Reverts #7588 which caused
scala/bug#11636.

See #8246 for context.

@szeiger szeiger added this to the 2.13.1 milestone Sep 10, 2019
@SethTisue SethTisue added the prio:blocker release blocker (used only by core team, only near release time) label Sep 10, 2019
@joshlemer
Copy link
Member

joshlemer commented Sep 10, 2019

Should we add to VectorTest.scala?

  @Test
  def i11636(): Unit = {

    val a: Vector[String] = "O" +: Iterator.continually("E").take(2101).foldLeft(Vector.empty[String])((v, e) => v :+ e) :+ "C"
    val a0: ArraySeq[String] = ArraySeq("O") ++ Iterator.continually("E").take(2101) ++ ArraySeq("C")

    val b: Vector[String] = "O" +: Iterator.continually("E").take(223) .foldLeft(Vector.empty[String])((v, e) => v :+ e) :+ "C"
    val b0: ArraySeq[String] = ArraySeq("O") ++ Iterator.continually("E").take(223) ++ ArraySeq("C")

    val c: Vector[String] = "O" +: Iterator.continually("E").take(135) .foldLeft(Vector.empty[String])((v, e) => v :+ e) :+ "C"
    val c0: ArraySeq[String] = ArraySeq("O") ++ Iterator.continually("E").take(135) ++ ArraySeq("C")

    val d: Vector[String] = "O" +: Iterator.continually("E").take(0)   .foldLeft(Vector.empty[String])((v, e) => v :+ e) :+ "C"
    val d0: ArraySeq[String] = ArraySeq("O", "C")

    val e: Vector[String] = "O" +: Iterator.continually("E").take(376) .foldLeft(Vector.empty[String])((v, e) => v :+ e) :+ "C"
    val e0: ArraySeq[String] = ArraySeq("O") ++ Iterator.continually("E").take(376) ++ ArraySeq("C")

    val f: Vector[String] = "O" +: Iterator.continually("E").take(365) .foldLeft(Vector.empty[String])((v, e) => v :+ e) :+ "C"
    val f0: ArraySeq[String] = ArraySeq("O") ++ Iterator.continually("E").take(365) ++ ArraySeq("C")
    
    assertEquals(a0, a)
    assertEquals(b0, b)
    assertEquals(c0, c)
    assertEquals(d0, d)
    assertEquals(e0, e)
    assertEquals(f0, f)

    assertEquals(a0 ++ b0, a ++ b)
    assertEquals(a0 ++ b0 ++ c0, a ++ b ++ c)
    assertEquals(a0 ++ b0 ++ c0 ++ d0, a ++ b ++ c ++ d)
    assertEquals(a0 ++ b0 ++ c0 ++ d0 ++ e0, a ++ b ++ c ++ d ++ e)
    assertEquals(a0 ++ b0 ++ c0 ++ d0 ++ e0 ++ f0, a ++ b ++ c ++ d ++ e ++ f)
  }

@@ -110,7 +110,7 @@ object Vector extends StrictOptimizedSeqFactory[Vector] {
* @define mayNotTerminateInf
* @define willNotTerminateInf
*/
final class Vector[+A] private[immutable] (private[collection] val startIndex: Int, private[collection] val endIndex: Int, private[immutable] val focus: Int)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line doesn't need to change.

@szeiger szeiger force-pushed the wip/revert-7588 branch 2 times, most recently from 83bd8ae to d4d59b1 Compare September 11, 2019 13:39
@szeiger
Copy link
Member Author

szeiger commented Sep 11, 2019

sigh the MiMa whitelist is really, really annoying. Almost every PR requires new entries which will cause conflicts with every other PR.

This reverts commit 18224fd.

# Conflicts:
#	src/library/scala/collection/immutable/Vector.scala

Reverts most of  scala#7588 which caused
scala/bug#11636.
@joshlemer
Copy link
Member

Thank you @szeiger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio:blocker release blocker (used only by core team, only near release time)
Projects
None yet
3 participants