mirror of
git://git.code.sf.net/p/sbcl/sbcl
synced 2026-09-10 07:26:40 -04:00
Fix type error with closure as :TEST in MAKE-HASH-TABLE
This commit is contained in:
parent
32bac2662e
commit
61b1a8b5cb
|
|
@ -136,7 +136,7 @@
|
|||
|
||||
;; The type of hash table this is. Part of the exported interface,
|
||||
;; as well as needed for the MAKE-LOAD-FORM and PRINT-OBJECT methods.
|
||||
(test nil :type symbol :read-only t)
|
||||
(test nil :type (or symbol function) :read-only t)
|
||||
;; How much to grow the hash table by when it fills up. If an index,
|
||||
;; then add that amount. If a floating point number, then multiply
|
||||
;; it by that.
|
||||
|
|
|
|||
|
|
@ -444,7 +444,7 @@ Examples:
|
|||
(dolist (info *user-hash-table-tests*
|
||||
(if hash-function
|
||||
(if (functionp test)
|
||||
(values -1 (%fun-name test) test nil)
|
||||
(values -1 test test nil)
|
||||
(values -1 test (%coerce-callable-to-fun test) nil))
|
||||
(error "Unknown :TEST for MAKE-HASH-TABLE: ~S" test)))
|
||||
(destructuring-bind (test-name test-fun hash-fun) info
|
||||
|
|
|
|||
13
tests/hash-custom-test.pure.lisp
Normal file
13
tests/hash-custom-test.pure.lisp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
(with-test (:name (:hash-table :custom-hash-function :closure))
|
||||
(flet ((equal-p (left right)
|
||||
(equal left right))
|
||||
(hash (item)
|
||||
(sxhash item)))
|
||||
(let ((table (make-hash-table :test #'equal-p
|
||||
:hash-function #'hash)))
|
||||
(loop for i from 0 to 100
|
||||
do (progn
|
||||
(setf (gethash i table) i)
|
||||
(assert (= (gethash i table) i))))
|
||||
(assert (= (hash-table-count table) 101))
|
||||
(assert (eq (hash-table-test table) #'equal-p)))))
|
||||
Loading…
Reference in a new issue