mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
cl-preloaded.el: Fix the type lattice
We generally want types to form not just a DAG but a lattice. If objects can be both `keyword` and `symbol-with-pos`, this means there should be a more precise type describing this intersection. If we ever find the need for such a refinement, we could add such a `keyword-with-pos` type, but here I took the simpler route of treating `keyword` not as a proper built-in type but as a second-class type like `natnum`. While fixing this problem, also fix the problem we had where `functionp` was not quite adequate to characterize objects of type `function`, by introducing a new predicate `cl-functionp` for that. * lisp/emacs-lisp/cl-preloaded.el (cl-functionp): New function. (function): Use it. (keyword): Don't declare it as a built-in type. (user-ptrp): Remove redundant declaration. * lisp/emacs-lisp/cl-generic.el (cl--generic--unreachable-types): Delete constant. (cl-generic-generalizers): Remove corresponding test. * lisp/emacs-lisp/cl-macs.el (cl-deftype-satisfies): Add entry for `keyword` type. * lisp/emacs-lisp/comp.el (comp-known-predicates): Fix type for negative result of `characterp`. Remove duplicate `numberp` entry. Fix types for `keywordp` now that `keyword` is not a built-in type any more. * test/src/data-tests.el (data-tests--cl-type-of): Add a few cases. Remove workaround for `function`.
This commit is contained in:
parent
351d98535d
commit
004f2493a5
6 changed files with 37 additions and 36 deletions
|
|
@ -3467,6 +3467,7 @@ Of course, we really can't know that for sure, so it's just a heuristic."
|
|||
'((base-char . characterp) ;Could be subtype of `fixnum'.
|
||||
(character . natnump) ;Could be subtype of `fixnum'.
|
||||
(command . commandp) ;Subtype of closure & subr.
|
||||
(keyword . keywordp) ;Would need `keyword-with-pos`.
|
||||
(natnum . natnump) ;Subtype of fixnum & bignum.
|
||||
(real . numberp) ;Not clear where it would fit.
|
||||
))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue