Scala Programming Language
  1. Scala Programming Language
  2. SI-8100

Stream flatten throws StackOverflowException

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Scala 2.11.0-M8
    • Component/s: None
    • Labels:
      None

      Description

      As reported on scala-internals by Matthew Pocock, a Stream[Option[A]] containing mostly (or entirely) None instances will throw a SOE when flattened.

      Easy to reproduce via:

      Stream.from(0).take(100000).map(_ => None).flatten.length
      

      That should return 0 but will throw a SOE.

        Activity

        Hide
        Erik Osheim added a comment -

        Here's a PR that fixes the issue: https://github.com/scala/scala/pull/3304

        The test suite was taking too long, but I'm pretty sure all the tests will pass.

        Show
        Erik Osheim added a comment - Here's a PR that fixes the issue: https://github.com/scala/scala/pull/3304 The test suite was taking too long, but I'm pretty sure all the tests will pass.

          People

          • Assignee:
            Erik Osheim
            Reporter:
            Erik Osheim
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development