From feebc7131c669b212e6a6ff73585a879baff2c48 Mon Sep 17 00:00:00 2001 From: Rex Kerr Date: Mon, 23 Dec 2013 15:34:18 -0800 Subject: 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). --- src/library/scala/util/Sorting.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/library') 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 } -- cgit v1.2.3