# HG changeset patch # User Aidan Kehoe # Date 1428771977 -3600 # Node ID bd644055ef44ca0cad95c1bdc0aef9b5d4a99bca # Parent a85efdabe23702f3b88f1c59ab668475ebad8da6 Correct a bug in #'check-type, non-setf'able PLACEs lisp/ChangeLog addition: 2015-04-11 Aidan Kehoe * 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 * automated/lisp-tests.el: Check for a bug just fixed in cl-macs.el. diff -r a85efdabe237 -r bd644055ef44 lisp/ChangeLog --- 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 + + * 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 * gutter-items.el (append-progress-feedback): diff -r a85efdabe237 -r bd644055ef44 lisp/cl-macs.el --- 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))))) diff -r a85efdabe237 -r bd644055ef44 tests/ChangeLog --- 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 + + * automated/lisp-tests.el: + Check for a bug just fixed in cl-macs.el. + 2015-04-08 Aidan Kehoe * automated/lisp-tests.el: diff -r a85efdabe237 -r bd644055ef44 tests/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