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

StackOverFlowError when modifying examples/sort2.scala #4961

Closed
scabug opened this issue Sep 1, 2011 · 3 comments
Closed

StackOverFlowError when modifying examples/sort2.scala #4961

scabug opened this issue Sep 1, 2011 · 3 comments
Assignees

Comments

@scabug
Copy link

scabug commented Sep 1, 2011

When expanding the List to be sorted by examples/sort2.scala to some more values like val xs2 = List(6, 2, 8, 5, 112,-44,-22,109,56,-66,43,42,109,-111,2341) the program crashes with a StackOverFlowError.

As a scala beginner I have no idea if this error is due to the algorithm used in the example or if it reveals some bigger bug in Scala.

This is the stacktrace:
Exception in thread "main" java.lang.StackOverflowError
at scala.collection.mutable.ListBuffer.$plus$eq(ListBuffer.scala:115)
at scala.collection.mutable.ListBuffer.$plus$eq(ListBuffer.scala:42)
at scala.collection.TraversableLike$$anonfun$filter$1.apply(TraversableLike.scala:213)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.TraversableLike$class.filter(TraversableLike.scala:212)
at scala.collection.immutable.List.filter(List.scala:45)
at examples.sort2$.sort(sort2.scala:14)

@scabug
Copy link
Author

scabug commented Sep 1, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4961?orig=1
Reporter: Carlo Luib-Finettti (carlolf)
Affected Versions: 2.9.1

@scabug
Copy link
Author

scabug commented Oct 29, 2011

@paulp said:
Bug in the sort algorithm, will check in fix shortly.

@scabug
Copy link
Author

scabug commented Oct 29, 2011

Commit Message Bot (anonymous) said:
(extempore in r25909) Fix bug in example sort.

Embarrassing bug causes sort to explode if there are any
duplicated elements. Closes #4961, no review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants