scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

Reverse on SequenceView throws StackOverFlowError #2548

Closed scabug closed 13 years ago

scabug commented 14 years ago

As summarized above, calling reverse on a SequenceView throws a StackOverFlowError. Example:

scala> List(1,2,3,4,5,6).view.reverse
java.lang.StackOverflowError
        at scala.collection.generic.SequenceViewTemplate$$$$anon$$8.<init>(SequenceViewTemplate.scala:136)
        at scala.collection.generic.SequenceViewTemplate$$class.newReversed(SequenceViewTemplate.scala:136)
        at scala.collection.generic.SequenceTemplate$$$$anon$$3.newReversed(SequenceTemplate.scala:433)
        at scala.collection.generic.SequenceViewTemplate$$class.reverse(Seq...

Observed on scala-2.8.0.r18997-b20091009021954, downloaded from nightly.

scabug commented 14 years ago

Imported From: https://issues.scala-lang.org/browse/SI-2548?orig=1 Reporter: @dcsobral

scabug commented 14 years ago

@paulp said: I would need advice on how to deal with this. I'm finding the coupling between X, XLike, and XView blocks any interesting change I attempt to make. In particular I thought the loop ought to be cut off by overriding view in the *View classes, but with each of Coll, Repr, and This waving their own list of demands, I didn't see how to get anywhere that way.

scabug commented 14 years ago

@axel22 said: (In r20288) fixed #2548 - reverse, reverseIterator for views bug. Also - reverseMap for views now should work. review by phaller.