diff options
author | Philipp Stephani <phst@google.com> | 2017-12-21 18:25:49 +0100 |
---|---|---|
committer | Philipp Stephani <phst@google.com> | 2018-01-28 19:21:47 +0100 |
commit | 9a747b3554515135d5acadfcb5c2b1b8240d8f84 (patch) | |
tree | 3e1511ef5cbef7876e44a4f1ef4f2d7550e772db /lisp/emacs-lisp/cl-macs.el | |
parent | a718e1593ae7332fafe734f880181e2d8ecc34df (diff) | |
download | emacs-9a747b3554515135d5acadfcb5c2b1b8240d8f84.tar.gz emacs-9a747b3554515135d5acadfcb5c2b1b8240d8f84.tar.bz2 emacs-9a747b3554515135d5acadfcb5c2b1b8240d8f84.zip |
Prevent name clashes between CL structures and builtin types
* lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Don't allow
structures with the same names as builtin types.
(cl--typeof-types, cl--all-builtin-types): Move from cl-generic.el and
rename.
(cl--struct-name-p): New helper function.
* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Don't allow structures
with the same names as builtin types.
* lisp/emacs-lisp/cl-generic.el (cl--generic-typeof-generalizer)
(cl-generic-generalizers): Adapt to name change.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-defstruct/builtin-type):
* test/lisp/emacs-lisp/cl-preloaded-tests.el
(cl-struct-define/builtin-type): New unit tests.
* etc/NEWS: Document changed behavior.
Diffstat (limited to 'lisp/emacs-lisp/cl-macs.el')
-rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 43eb4261162..4aed1f26624 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2687,6 +2687,9 @@ non-nil value, that slot cannot be set via `setf'. (forms nil) (docstring (if (stringp (car descs)) (pop descs))) pred-form pred-check) + ;; Can't use `cl-check-type' yet. + (unless (cl--struct-name-p name) + (signal 'wrong-type-argument (list 'cl-struct-name-p name 'name))) (setq descs (cons '(cl-tag-slot) (mapcar (function (lambda (x) (if (consp x) x (list x)))) descs))) |