unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrea Corallo <acorallo@gnu.org>
To: 66615@debbugs.gnu.org
Cc: "Mattias Engdegård" <mattias.engdegard@gmail.com>,
	"Stefan Monnier" <monnier@iro.umontreal.ca>
Subject: bug#66615: 30.0.50; Inconsistent 'number-or-marker' type definition in the cl- machinery
Date: Wed, 18 Oct 2023 13:59:21 -0400	[thread overview]
Message-ID: <yp134y7zu9y.fsf@fencepost.gnu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1072 bytes --]

Hello all,

while performing some development I noticed that 'number-or-marker' is
mentioned as a type in 'cl--typeof-types'.

Unfortunatelly its entry is missing in 'cl-deftype-satisfies' (see
cl-macs.el:3469).

My question is, why do we consider 'number-or-marker' in the first place
a type if we support the or syntax in `cl-typep' like
(cl-typep 3 '(or marker number)) ?

I'd like to fix this inconsistency in order to progress with my
development, originally I worked out the attached patch but I now
suspect that (unless there's a specific reason) we should just remove
'number-or-marker' as a type entirely instead.

WDYT? Thanks

  Andrea

PS also I think we have a similar issue/question with
'integer-or-marker'.

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-two-missing-number-or-marker-entries-to-the-cl-m.patch --]
[-- Type: text/x-diff, Size: 3563 bytes --]

From 05d85f19e51c15df8824df8e8608784ec79b37cf Mon Sep 17 00:00:00 2001
From: Andrea Corallo <acorallo@gnu.org>
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


             reply	other threads:[~2023-10-18 17:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-18 17:59 Andrea Corallo [this message]
2023-10-18 18:30 ` bug#66615: 30.0.50; Inconsistent 'number-or-marker' type definition in the cl- machinery Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-19  8:56   ` Andrea Corallo
2023-10-19 12:02     ` Andrea Corallo
2023-10-19 14:22       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-19 21:24         ` Andrea Corallo
2023-10-19 22:34           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-20  9:05             ` Andrea Corallo
2023-10-20 13:45               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-20 15:42                 ` Andrea Corallo
2023-10-20 20:51                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-22  7:03                     ` Andrea Corallo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yp134y7zu9y.fsf@fencepost.gnu.org \
    --to=acorallo@gnu.org \
    --cc=66615@debbugs.gnu.org \
    --cc=mattias.engdegard@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).