From 05d85f19e51c15df8824df8e8608784ec79b37cf Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Wed, 18 Oct 2023 16:10:08 +0200 Subject: [PATCH] Add two missing 'number-or-marker' entries to the cl machinery. Assuming 'number-or-marker' is a type (as present multiple times in cl--typeof-types) adding some missing entries for coherency. * lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Add 'number-or-marker' as supertype of 'number' in the 'float' branch. * lisp/emacs-lisp/cl-macs.el (cl-deftype-satisfies): Add 'number-or-marker'. * test/lisp/emacs-lisp/comp-cstr-tests.el (comp-cstr-typespec-tests-alist): Update test. * test/src/comp-tests.el (comp-tests-type-spec-tests): Update two testes. --- lisp/emacs-lisp/cl-macs.el | 3 ++- lisp/emacs-lisp/cl-preloaded.el | 4 ++-- test/lisp/emacs-lisp/comp-cstr-tests.el | 2 +- test/src/comp-tests.el | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 8025a64f1bf..722d561b9f4 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -3502,7 +3502,8 @@ cl--macroexp-fboundp (symbol . symbolp) (vector . vectorp) (window . windowp) - ;; FIXME: Do we really want to consider this a type? + ;; FIXME: Do we really want to consider these types? + (number-or-marker . number-or-marker-p) (integer-or-marker . integer-or-marker-p) )) (put type 'cl-deftype-satisfies pred)) diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el index 676326980aa..96e288db7d5 100644 --- a/lisp/emacs-lisp/cl-preloaded.el +++ b/lisp/emacs-lisp/cl-preloaded.el @@ -58,8 +58,8 @@ cl--typeof-types ;; Markers aren't `numberp', yet they are accepted wherever integers are ;; accepted, pretty much. (marker number-or-marker atom) - (overlay atom) (float number atom) (window-configuration atom) - (process atom) (window atom) + (overlay atom) (float number number-or-marker atom) + (window-configuration 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) diff --git a/test/lisp/emacs-lisp/comp-cstr-tests.el b/test/lisp/emacs-lisp/comp-cstr-tests.el index a4f282fcfef..d2f552af6fa 100644 --- a/test/lisp/emacs-lisp/comp-cstr-tests.el +++ b/test/lisp/emacs-lisp/comp-cstr-tests.el @@ -191,7 +191,7 @@ ;; 74 ((and boolean (or number marker)) . nil) ;; 75 - ((and atom (or number marker)) . (or marker number)) + ((and atom (or number marker)) . number-or-marker) ;; 76 ((and symbol (or number marker)) . nil) ;; 77 diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 4444ab61219..31871bb2eec 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -977,7 +977,7 @@ comp-tests-check-ret-type-spec (if (= x y) x 'foo)) - '(or (member foo) marker number)) + '(or (member foo) marker-or-number)) ;; 14 ((defun comp-tests-ret-type-spec-f (x) @@ -1117,7 +1117,7 @@ comp-tests-check-ret-type-spec ((defun comp-tests-ret-type-spec-f (x) (when (> x 1.0) x)) - '(or null marker number)) + '(or null number-or-marker)) ;; 36 ((defun comp-tests-ret-type-spec-f (x y) -- 2.25.1