]> gitweb.factorcode.org Git - factor.git/commitdiff
core: declare word's hashcode an integer. Make word not flushable since it's mutable...
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 18 Jul 2015 07:27:12 +0000 (00:27 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 18 Jul 2015 07:27:12 +0000 (00:27 -0700)
Fixes #1392. @bjourne found this.

core/hashtables/hashtables-tests.factor
core/words/words.factor

index bf512296a15aed566b31e8bbd86693484b2296ae..63c7c506ac3cebc666683155750ad2be2f730b62 100644 (file)
@@ -1,6 +1,5 @@
-USING: accessors assocs continuations fry hashtables io kernel
-make math namespaces prettyprint sequences sequences.private
-tools.test vectors ;
+USING: accessors assocs continuations fry hashtables kernel make
+math namespaces sequences slots.private tools.test ;
 IN: hashtables.tests
 
 { H{ } } [ { } [ dup ] H{ } map>assoc ] unit-test
@@ -186,3 +185,16 @@ H{ } "x" set
 
 ! Random test case
 { "A" } [ 100 iota [ dup ] H{ } map>assoc 32 over delete-at "A" 32 pick set-at 32 of ] unit-test
+
+! Bug 1392, word's hashcode was declared a fixnum
+! It fails depending on hash growth, so test in a loop
+SYMBOL: +bignum-hashcode+
+-405534154 +bignum-hashcode+ 1 set-slot
+{ t } [
+    100 iota [
+        drop
+        H{ } clone
+        f +bignum-hashcode+ pick set-at
+        +bignum-hashcode+ +bignum-hashcode+ pick set-at assoc-size 1 =
+    ] all?
+] unit-test
index 6e1fb31bac281cde567aebe6fb72964c8547d39f..b37d1e0580b07d161de41ff5de35d42331eab4d0 100644 (file)
@@ -263,7 +263,7 @@ M: word forget*
     ] if ;
 
 M: word hashcode*
-    nip 1 slot { fixnum } declare ; inline foldable
+    nip 1 slot { integer } declare ; inline
 
 M: word literalize <wrapper> ;