From a4e163d2627f332f4c05fcf729b8bb5e843b0ed1 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Fri, 17 Sep 2010 05:03:43 +0000 Subject: Some tweaks to ListSet to make it less patholog... Some tweaks to ListSet to make it less pathological in its outlook. We can see some modest improvements in run time and answer quality via the enclosed test case: // with this patch: 2.250s elapsed, assertions pass. // without this patch: 51.441s elapsed, and it's a mercy killing: java.lang.StackOverflowError at scala.collection.immutable.ListSet$Node.contains(ListSet.scala:117) at scala.collection.immutable.ListSet$Node.contains(ListSet.scala:117) Closes #3822, review by community. --- test/files/run/bug3822.scala | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test/files/run/bug3822.scala (limited to 'test/files/run') diff --git a/test/files/run/bug3822.scala b/test/files/run/bug3822.scala new file mode 100644 index 0000000000..7401ecbde2 --- /dev/null +++ b/test/files/run/bug3822.scala @@ -0,0 +1,13 @@ +import scala.collection.{ mutable, immutable, generic } +import immutable.ListSet + +object Test { + def main(args: Array[String]): Unit = { + val xs = ListSet(-100000 to 100001: _*) + + assert(xs.size == 200002) + assert(xs.sum == 100001) + } +} + + -- cgit v1.2.3