]> git.eshelyaron.com Git - emacs.git/commit
cl-types: Simplify a bit further
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 5 May 2025 18:57:05 +0000 (14:57 -0400)
committerEshel Yaron <me@eshelyaron.com>
Sat, 10 May 2025 08:51:18 +0000 (10:51 +0200)
commit4143dd0e838eff456f6e447f504481e7cf5ec766
treee7b4caccee97a448b6e8f54f8d6b0fbdbe940084
parentd54a4aec26820b87cbf095beb956d92efebafd5d
cl-types: Simplify a bit further

Mostly, get rid of `cl--type-flag` and rely only on the presence/absence
of the type on `cl--types-list` to "flag" erroring-types.
Also, don't try and catch errors during dispatch.

* lisp/emacs-lisp/cl-types.el (cl--type-dispatch-list): Move to the
relevant section.
(cl--type-parents): Inline into sole caller.
(cl--type-deftype): Add `arglist` argument.
Don't signal an error if the type already existed but wasn't in
`cl--type-list` since that's normal and we can fix it.
Don't touch `cl--type-flag` any more.
Don't add to `cl--type-list` if it can't be used without arguments.
(cl-deftype2): Adjust call accordingly.
(cl--type-error): Inline into sole caller.
(cl-types-of): Be more careful to preserve ordering of types
before passing them to `merge-ordered-lists`.
Add `types` argument for use by dispatch.
Don't bother skipping the `root-type` since that's a built-in type,
so it should never happen anyway.
Don't catch errors if called from dispatch.
Don't bother with `cl--type-flag`.
(cl--type-generalizer): Use new arg of `cl-types-of` instead of
let-binding `cl--type-list`, in case `cl-types-of` ends up (auto)loading
a file or some such thing which needs to use/modify `cl--type-list`.
(cl--type-undefine): Move to end of file.

* test/lisp/emacs-lisp/cl-types-tests.el (cl-types-test): Remove DAG
test since we don't detect such errors any more.
Relax ordering test when the order is not guaranteed
by parent-relationships.

(cherry picked from commit 68a50324a70bd794d7f3228290310093f1515f7b)
lisp/emacs-lisp/cl-types.el
test/lisp/emacs-lisp/cl-types-tests.el