summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRex Kerr <ichoran@gmail.com>2013-12-23 15:34:18 -0800
committerRex Kerr <ichoran@gmail.com>2013-12-31 11:42:09 -0800
commitfeebc7131c669b212e6a6ff73585a879baff2c48 (patch)
treebf4522f4947ef391e2dcd6d17b2c25ead58509f2 /src
parentb2bf66a4681dec76281da9469e66e0100ad2709f (diff)
downloadscala-feebc7131c669b212e6a6ff73585a879baff2c48.tar.gz
scala-feebc7131c669b212e6a6ff73585a879baff2c48.tar.bz2
scala-feebc7131c669b212e6a6ff73585a879baff2c48.zip
SI-7837 quickSort, along with Ordering[K], may result in stackoverflow because the code uses '==' instead of 'equiv'
== instead of equiv (from Ordering) was used by mistake. Fixed. Also created a test to make sure that == is not used by throwing an exception if it is (as suggested by Jason).
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/util/Sorting.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/library/scala/util/Sorting.scala b/src/library/scala/util/Sorting.scala
index 276e157f55..2e021ad9d9 100644
--- a/src/library/scala/util/Sorting.scala
+++ b/src/library/scala/util/Sorting.scala
@@ -141,14 +141,14 @@ object Sorting {
var done = false
while (!done) {
while (b <= c && x(b) <= v) {
- if (x(b) == v) {
+ if (x(b) equiv v) {
swap(a, b)
a += 1
}
b += 1
}
while (c >= b && x(c) >= v) {
- if (x(c) == v) {
+ if (x(c) equiv v) {
swap(c, d)
d -= 1
}