mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
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.
This commit is contained in:
parent
a718e1593a
commit
9a747b3554
6 changed files with 84 additions and 30 deletions
|
|
@ -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)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue