summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-09-17 05:03:43 +0000
committerPaul Phillips <paulp@improving.org>2010-09-17 05:03:43 +0000
commita4e163d2627f332f4c05fcf729b8bb5e843b0ed1 (patch)
treef3f2d9d4fd69bf0dd9e198b4082554f1f5855a27 /test/files/run
parent99fb2b420f2fbf0eca5a98d0e52f8c6b580cd18f (diff)
downloadscala-a4e163d2627f332f4c05fcf729b8bb5e843b0ed1.tar.gz
scala-a4e163d2627f332f4c05fcf729b8bb5e843b0ed1.tar.bz2
scala-a4e163d2627f332f4c05fcf729b8bb5e843b0ed1.zip
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.
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/bug3822.scala13
1 files changed, 13 insertions, 0 deletions
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)
+ }
+}
+
+