Patch by Walter C. Pelissero, based on CMUCL code.
Also fix stale LOGICAL-PATHNAME test, left out from 1.0.31.17.
(sxhash-recurse (cdr x) (1- depthoid)))
261835505)))
(instance
- (if (or (typep x 'structure-object) (typep x 'condition))
- (logxor 422371266
- (sxhash ; through DEFTRANSFORM
- (classoid-name
- (layout-classoid (%instance-layout x)))))
- (sxhash-instance x)))
+ (if (pathnamep x)
+ ;; Pathnames are EQUAL if all the components are EQUAL, so
+ ;; we hash all of the components of a pathname together.
+ (let ((hash (sxhash-recurse (pathname-host x) depthoid)))
+ (mixf hash (sxhash-recurse (pathname-device x) depthoid))
+ (mixf hash (sxhash-recurse (pathname-directory x) depthoid))
+ (mixf hash (sxhash-recurse (pathname-name x) depthoid))
+ (mixf hash (sxhash-recurse (pathname-type x) depthoid))
+ ;; Hash :NEWEST the same as NIL because EQUAL for
+ ;; pathnames assumes that :newest and nil are equal.
+ (let ((version (%pathname-version x)))
+ (mixf hash (sxhash-recurse (if (eq version :newest)
+ nil
+ version)
+ depthoid))))
+ (if (or (typep x 'structure-object) (typep x 'condition))
+ (logxor 422371266
+ (sxhash ; through DEFTRANSFORM
+ (classoid-name
+ (layout-classoid (%instance-layout x)))))
+ (sxhash-instance x))))
(symbol (sxhash x)) ; through DEFTRANSFORM
(array
(typecase x
;; Need to make another access to the hash to disable the last-seen-element
;; cache.
(setf (gethash 'y hash) t)
- (assert (gethash a hash)))
\ No newline at end of file
+ (assert (gethash a hash)))
+
+;;; Minimum quality checks
+(assert (/= (sxhash "foo") (sxhash "bar")))
+(assert (/= (sxhash (pathname "foo.txt")) (sxhash (pathname "bar.txt"))))
+(assert (/= (sxhash (list 1 2 3)) (sxhash (list 3 2 1))))
+(assert (/= (sxhash #*1010) (sxhash #*0101)))
(setf (logical-pathname-translations "demo0")
'(("**;*.*.*" "/tmp/")))
-;;; In case of a parse error we want to get a condition of type
-;;; CL:PARSE-ERROR (or more specifically, of type
-;;; SB-KERNEL:NAMESTRING-PARSE-ERROR).
+;;; In case of a parse error we want to get a condition of type TYPE-ERROR,
+;;; because ANSI says so. (This used to be PARSE-ERROR.)
(assert
(typep (grab-condition (logical-pathname "demo0::bla;file.lisp"))
- 'parse-error))
+ 'type-error))
;;; some things SBCL-0.6.9 used not to parse correctly:
;;;
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.31.17"
+"1.0.31.18"