summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorJosh Suereth <Joshua.Suereth@gmail.com>2012-08-11 04:51:48 -0700
committerJosh Suereth <Joshua.Suereth@gmail.com>2012-08-11 04:51:48 -0700
commit837a68bef7501d8a641163635adbdccdbfe4c5b8 (patch)
tree9756f37296ef0747ae96ecd27b74fc2ed0f2348a /test/files
parentffca128c5caeb1921bdbfb3736f649ffcdbb2af3 (diff)
parent46848a9b6abbed8d719bd7ef88a8d510675cbb03 (diff)
downloadscala-837a68bef7501d8a641163635adbdccdbfe4c5b8.tar.gz
scala-837a68bef7501d8a641163635adbdccdbfe4c5b8.tar.bz2
scala-837a68bef7501d8a641163635adbdccdbfe4c5b8.zip
Merge pull request #1105 from rklaehn/SI-6197
Only create a HashTrieSet if necessary.
Diffstat (limited to 'test/files')
-rw-r--r--test/files/run/t6197.check0
-rw-r--r--test/files/run/t6197.scala21
2 files changed, 21 insertions, 0 deletions
diff --git a/test/files/run/t6197.check b/test/files/run/t6197.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/run/t6197.check
diff --git a/test/files/run/t6197.scala b/test/files/run/t6197.scala
new file mode 100644
index 0000000000..5ab4b002d7
--- /dev/null
+++ b/test/files/run/t6197.scala
@@ -0,0 +1,21 @@
+import scala.collection.immutable._
+
+object Test extends App {
+
+ // test that a HashTrieSet with one leaf element is not created!
+ val x = HashSet.empty + 1 + 2
+ if(x.getClass.getSimpleName != "HashTrieSet")
+ println("A hash set containing two non-colliding values should be a HashTrieSet")
+
+ val y = x - 1
+ if(y.getClass.getSimpleName != "HashSet1")
+ println("A hash set containing one element should always use HashSet1")
+
+ // it is pretty hard to test that the case where a HashTrieSet has one element which
+ // is itself of type HashTrieS t. That is because the improve hash function makes it very difficult
+ // to find keys that will have hashes that are close together.
+ //
+ // However, it is also not necessary. Removing the ability of a HashTrieSet to have
+ // one child of type HashTrieSet completely breaks the HashSet, so that many other
+ // tests fail
+}