CL types: Accept both byte-code-function and compiled-function

`type-of` returns `compiled-function` for bytecode functions, but the
predicate for those objects is called `byte-code-function-p`,
So accept both `compiled-function` and `byte-code-function` as type
names for those objects.

* lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types):
Add `byte-code-function`.
* lisp/emacs-lisp/cl-macs.el (byte-code-function, compiled-function, subr):
New types.
This commit is contained in:
Stefan Monnier 2022-04-29 15:29:35 -04:00
parent b566454449
commit acc985ae7c
3 changed files with 15 additions and 2 deletions

View file

@ -3403,9 +3403,11 @@ Of course, we really can't know that for sure, so it's just a heuristic."
(boolean . booleanp)
(bool-vector . bool-vector-p)
(buffer . bufferp)
(byte-code-function . byte-code-function-p)
(character . natnump)
(char-table . char-table-p)
(command . commandp)
(compiled-function . byte-code-function-p)
(hash-table . hash-table-p)
(cons . consp)
(fixnum . fixnump)
@ -3419,6 +3421,7 @@ Of course, we really can't know that for sure, so it's just a heuristic."
(null . null)
(real . numberp)
(sequence . sequencep)
(subr . subrp)
(string . stringp)
(symbol . symbolp)
(vector . vectorp)

View file

@ -59,7 +59,17 @@
;; accepted, pretty much.
(marker number-or-marker atom)
(overlay atom) (float number atom) (window-configuration atom)
(process atom) (window atom) (subr atom) (compiled-function function atom)
(process atom) (window atom)
;; FIXME: We'd want to put `function' here, but that's only true
;; for those `subr's which aren't special forms!
(subr atom)
;; FIXME: We should probably reverse the order between
;; `compiled-function' and `byte-code-function' since arguably
;; `subr' and also "compiled functions" but not "byte code functions",
;; but it would require changing the value returned by `type-of' for
;; byte code objects, which risks breaking existing code, which doesn't
;; seem worth the trouble.
(compiled-function byte-code-function function atom)
(module-function function atom)
(buffer atom) (char-table array sequence atom)
(bool-vector array sequence atom)

View file

@ -513,7 +513,7 @@ HOW can be one of:
(t (symbol-function symbol)))
function props)
;; FIXME: We could use a defmethod on `function-documentation' instead,
;; except when (or (not nf) (autoloadp nf))!
;; except when (autoloadp nf)!
(put symbol 'function-documentation `(advice--make-docstring ',symbol))
(add-function :around (get symbol 'defalias-fset-function)
#'advice--defalias-fset))