Mercurial > hg > xemacs-beta
changeset 5889:bd644055ef44
Correct a bug in #'check-type, non-setf'able PLACEs
lisp/ChangeLog addition:
2015-04-11 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el:
* cl-macs.el (check-type):
Correct the sense of the type test here when PLACE is not
setf'able, something which gave confusing errors with literal
fixnums or, e.g., (+ 30 40).
tests/ChangeLog addition:
2015-04-11 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-tests.el:
Check for a bug just fixed in cl-macs.el.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sat, 11 Apr 2015 18:06:17 +0100 |
parents | a85efdabe237 |
children | 8704b7957585 |
files | lisp/ChangeLog lisp/cl-macs.el tests/ChangeLog tests/automated/lisp-tests.el |
diffstat | 4 files changed, 29 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Thu Apr 09 14:54:37 2015 +0100 +++ b/lisp/ChangeLog Sat Apr 11 18:06:17 2015 +0100 @@ -1,3 +1,11 @@ +2015-04-11 Aidan Kehoe <kehoea@parhasard.net> + + * cl-macs.el: + * cl-macs.el (check-type): + Correct the sense of the type test here when PLACE is not + setf'able, something which gave confusing errors with literal + fixnums or, e.g., (+ 30 40). + 2015-04-04 Aidan Kehoe <kehoea@parhasard.net> * gutter-items.el (append-progress-feedback):
--- a/lisp/cl-macs.el Thu Apr 09 14:54:37 2015 +0100 +++ b/lisp/cl-macs.el Sat Apr 11 18:06:17 2015 +0100 @@ -3034,8 +3034,10 @@ (condition-case nil `(while (not ,test) ,(macroexpand `(setf ,place ,signal-error))) + ;; Common Lisp requires that PLACE be setfable, but this is + ;; never a restriction that this package has enforced. (error - `(if ,test (progn ,signal-error nil)))))) + `(if (not ,test) (progn ,signal-error nil)))))) (if (eq temp place) `(progn ,body nil) `(let ((,temp ,place)) ,body nil)))))
--- a/tests/ChangeLog Thu Apr 09 14:54:37 2015 +0100 +++ b/tests/ChangeLog Sat Apr 11 18:06:17 2015 +0100 @@ -1,3 +1,8 @@ +2015-04-11 Aidan Kehoe <kehoea@parhasard.net> + + * automated/lisp-tests.el: + Check for a bug just fixed in cl-macs.el. + 2015-04-08 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el:
--- a/tests/automated/lisp-tests.el Thu Apr 09 14:54:37 2015 +0100 +++ b/tests/automated/lisp-tests.el Sat Apr 11 18:06:17 2015 +0100 @@ -3796,4 +3796,17 @@ (Assert (eql ?\x09 (digit-char 9 nil binary-table)) "checking `digit-char' reflects RADIX-TABLE, 9, base 10")) +;; Check that a bug in #'check-type with non-setfable PLACE (something not +;; actually specified by Common Lisp) has been fixed. +(Assert (prog1 t (check-type 300 fixnum)) + "checking #'check-type OK, fixnum literal PLACE") +(Check-Error wrong-type-argument + (check-type 300 (integer -1 100)) + "checking #'check-type errors properly on fixnum literal PLACE") +(Assert (prog1 t (check-type (+ 100 200) fixnum)) + "checking #'check-type OK, non-setfable PLACE") +(Check-Error wrong-type-argument + (check-type (+ 600 1000) (integer 0 20)) + "checking #'check-type errors properly, non-setfable PLACE") + ;;; end of lisp-tests.el