Change 'type' declaration to 'ftype'
authorAndrea Corallo <acorallo@gnu.org>
Tue, 14 May 2024 07:24:05 +0000 (09:24 +0200)
committerAndrea Corallo <acorallo@gnu.org>
Tue, 14 May 2024 09:17:25 +0000 (11:17 +0200)
* lisp/window.el (get-lru-window, get-largest-window)
(one-window-p): Update function type declaration.
* lisp/subr.el (ignore, error, zerop, fixnump, bignump, lsh)
(last, eventp, mouse-movement-p, log10, memory-limit)
(internal-pop-keymap): Likewise.
* lisp/simple.el (count-lines, mark, string-empty-p): Likewise.
* lisp/files.el (parse-colon-path): Likewise.
* lisp/env.el (getenv): Likewise.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt): Likewise.
* lisp/emacs-lisp/lisp.el (buffer-end): Likewise.
* lisp/emacs-lisp/comp.el (comp--final): Likewise.
* lisp/custom.el (custom-variable-p): Likewise.
* lisp/emacs-lisp/byte-run.el (defun-declarations-alist): Rename 'type'
-> 'ftype'.

lisp/custom.el
lisp/emacs-lisp/byte-run.el
lisp/emacs-lisp/comp.el
lisp/emacs-lisp/lisp.el
lisp/emacs-lisp/regexp-opt.el
lisp/env.el
lisp/files.el
lisp/simple.el
lisp/subr.el
lisp/window.el

index 6f2aa18ba1dab545e538f8d513494524323a82c2..c049e8f8be08b57db79114c2516fd21f61e3b829 100644 (file)
@@ -667,7 +667,7 @@ If NOSET is non-nil, don't bother autoloading LOAD when setting the variable."
 A customizable variable is either (i) a variable whose property
 list contains a non-nil `standard-value' or `custom-autoload'
 property, or (ii) an alias for another customizable variable."
-  (declare (type (function (symbol) t))
+  (declare (ftype (function (symbol) t))
            (side-effect-free t))
   (when (symbolp variable)
     (setq variable (indirect-variable variable))
index 2acd22d0a6a4c394d15c4aed330368541044e002..2031049e6788ab88f7c1e987074c15a6032d4a1b 100644 (file)
@@ -251,7 +251,7 @@ If `error-free', drop calls even if `byte-compile-delete-errors' is nil.")
    (list 'completion #'byte-run--set-completion)
    (list 'modes #'byte-run--set-modes)
    (list 'interactive-args #'byte-run--set-interactive-args)
-   (list 'type #'byte-run--set-function-type))
+   (list 'ftype #'byte-run--set-function-type))
   "List associating function properties to their macro expansion.
 Each element of the list takes the form (PROP FUN) where FUN is
 a function.  For each (PROP . VALUES) in a function's declaration,
index f9fa83da585d320b66ff8c6fe804cff9363d3d25..83ca480616f7937da3500310a9f25f65b6a4ab2f 100644 (file)
@@ -3325,12 +3325,12 @@ Prepare every function for final compilation and drive the C back-end."
 ;; are assumed just to be true. Use with extreme caution...
 
 (defun comp-hint-fixnum (x)
-  (declare (type (function (t) fixnum))
+  (declare (ftype (function (t) fixnum))
            (gv-setter (lambda (val) `(setf ,x ,val))))
   x)
 
 (defun comp-hint-cons (x)
-  (declare (type (function (t) cons))
+  (declare (ftype (function (t) cons))
            (gv-setter (lambda (val) `(setf ,x ,val))))
   x)
 
index 9edc11ad1324b4073a4d9f4fe42284fe4378d582..e65eec508d9abbd96efb2ad4adf7ef5442e86284 100644 (file)
@@ -534,7 +534,7 @@ major mode's decisions about context.")
   "Return the \"far end\" position of the buffer, in direction ARG.
 If ARG is positive, that's the end of the buffer.
 Otherwise, that's the beginning of the buffer."
-  (declare (type (function ((or number marker)) integer))
+  (declare (ftype (function ((or number marker)) integer))
            (side-effect-free error-free))
   (if (> arg 0) (point-max) (point-min)))
 
index f23343a34c6e5e8250b8e215f702a9be0ab2f498..d655855fab2d263441e49d3b5c16ea8d64e5985d 100644 (file)
@@ -130,7 +130,7 @@ usually more efficient than that of a simplified version:
      (concat (car parens)
              (mapconcat \\='regexp-quote strings \"\\\\|\")
              (cdr parens))))"
-  (declare (type (function (list &optional t) string))
+  (declare (ftype (function (list &optional t) string))
            (pure t) (side-effect-free t))
   (save-match-data
     ;; Recurse on the sorted list.
index 7d0c7dd0126705518ddc102ed9eb443e3af00f07..28f4f8a1d61175d367fe4bd814a98da04a069421 100644 (file)
@@ -207,7 +207,7 @@ parameter.
 Otherwise, this function searches `process-environment' for
 VARIABLE.  If it is not found there, then it continues the search
 in the environment list of the selected frame."
-  (declare (type (function (string &optional frame) (or null string)))
+  (declare (ftype (function (string &optional frame) (or null string)))
            (side-effect-free t))
   (interactive (list (read-envvar-name "Get environment variable: " t)))
   (let ((value (getenv-internal (if (multibyte-string-p variable)
index c24e48e3db2b58c41bc7acd91bba04d0791b0726..ae6dc1d6b293115d530cde9a153a97b2b65db1ee 100644 (file)
@@ -862,7 +862,7 @@ GNU and Unix systems).  Substitute environment variables into the
 resulting list of directory names.  For an empty path element (i.e.,
 a leading or trailing separator, or two adjacent separators), return
 nil (meaning `default-directory') as the associated list element."
-  (declare (type (function (string) list)))
+  (declare (ftype (function (string) list)))
   (when (stringp search-path)
     (let ((spath (substitute-env-vars search-path))
           (double-slash-special-p
index deab52c4201caa0bccbfbc80a0c364edf37d40c6..cdbbd876e3b1ce53fc8961801232feea38426506 100644 (file)
@@ -1762,7 +1762,7 @@ not at the start of a line.
 
 When IGNORE-INVISIBLE-LINES is non-nil, invisible lines are not
 included in the count."
-  (declare (type (function ((or integer marker) (or integer marker) &optional t)
+  (declare (ftype (function ((or integer marker) (or integer marker) &optional t)
                            integer))
            (side-effect-free t))
   (save-excursion
@@ -6884,7 +6884,7 @@ is active, and returns an integer or nil in the usual way.
 
 If you are using this in an editing command, you are most likely making
 a mistake; see the documentation of `set-mark'."
-  (declare (type (function (&optional t) (or integer null)))
+  (declare (ftype (function (&optional t) (or integer null)))
            (side-effect-free t))
   (if (or force (not transient-mark-mode) mark-active mark-even-if-inactive)
       (marker-position (mark-marker))
@@ -11147,7 +11147,7 @@ killed."
 
 (defun lax-plist-get (plist prop)
   "Extract a value from a property list, comparing with `equal'."
-  (declare (type (function (list t) t))
+  (declare (ftype (function (list t) t))
            (pure t) (side-effect-free t) (obsolete plist-get "29.1"))
   (plist-get plist prop #'equal))
 
index d18765c2a5b3a34f18b307487d152bcc200e1317..d6481fdf73ec922ba5eff9782a5b84f25816b0ae 100644 (file)
@@ -451,7 +451,7 @@ This function accepts any number of arguments in ARGUMENTS.
 Also see `always'."
   ;; Not declared `side-effect-free' because we don't want calls to it
   ;; elided; see `byte-compile-ignore'.
-  (declare (type (function (&rest t) null))
+  (declare (ftype (function (&rest t) null))
            (pure t) (completion ignore))
   (interactive)
   nil)
@@ -481,7 +481,7 @@ for the sake of consistency.
 
 To alter the look of the displayed error messages, you can use
 the `command-error-function' variable."
-  (declare (type (function (string &rest t) nil))
+  (declare (ftype (function (string &rest t) nil))
            (advertised-calling-convention (string &rest args) "23.1"))
   (signal 'error (list (apply #'format-message args))))
 
@@ -547,21 +547,21 @@ was called."
   "Return t if NUMBER is zero."
   ;; Used to be in C, but it's pointless since (= 0 n) is faster anyway because
   ;; = has a byte-code.
-  (declare (type (function (number) boolean))
+  (declare (ftype (function (number) boolean))
            (pure t) (side-effect-free t)
            (compiler-macro (lambda (_) `(= 0 ,number))))
   (= 0 number))
 
 (defun fixnump (object)
   "Return t if OBJECT is a fixnum."
-  (declare (type (function (t) boolean))
+  (declare (ftype (function (t) boolean))
            (side-effect-free error-free))
   (and (integerp object)
        (<= most-negative-fixnum object most-positive-fixnum)))
 
 (defun bignump (object)
   "Return t if OBJECT is a bignum."
-  (declare (type (function (t) boolean))
+  (declare (ftype (function (t) boolean))
            (side-effect-free error-free))
   (and (integerp object) (not (fixnump object))))
 
@@ -575,7 +575,7 @@ Most uses of this function turn out to be mistakes.  We recommend
 to use `ash' instead, unless COUNT could ever be negative, and
 if, when COUNT is negative, your program really needs the special
 treatment of negative COUNT provided by this function."
-  (declare (type (function (integer integer) integer))
+  (declare (ftype (function (integer integer) integer))
            (compiler-macro
             (lambda (form)
               (macroexp-warn-and-return
@@ -754,7 +754,7 @@ treatment of negative COUNT provided by this function."
 If LIST is nil, return nil.
 If N is non-nil, return the Nth-to-last link of LIST.
 If N is bigger than the length of LIST, return LIST."
-  (declare (type (function (list &optional integer) list))
+  (declare (ftype (function (list &optional integer) list))
            (pure t) (side-effect-free t))    ; pure up to mutation
   (if n
       (and (>= n 0)
@@ -1592,7 +1592,7 @@ See also `current-global-map'.")
 
 (defun eventp (object)
   "Return non-nil if OBJECT is an input event or event object."
-  (declare (type (function (t) boolean))
+  (declare (ftype (function (t) boolean))
            (pure t) (side-effect-free error-free))
   (or (integerp object)
       (and (if (consp object)
@@ -1660,7 +1660,7 @@ in the current Emacs session, then this function may return nil."
 
 (defsubst mouse-movement-p (object)
   "Return non-nil if OBJECT is a mouse movement event."
-  (declare (type (function (t) boolean))
+  (declare (ftype (function (t) boolean))
            (side-effect-free error-free))
   (eq (car-safe object) 'mouse-movement))
 
@@ -1970,7 +1970,7 @@ be a list of the form returned by `event-start' and `event-end'."
 
 (defun log10 (x)
   "Return (log X 10), the log base 10 of X."
-  (declare (type (function (number) float))
+  (declare (ftype (function (number) float))
            (side-effect-free t) (obsolete log "24.4"))
   (log x 10))
 
@@ -3257,7 +3257,7 @@ It can be retrieved with `(process-get PROCESS PROPNAME)'."
 
 (defun memory-limit ()
   "Return an estimate of Emacs virtual memory usage, divided by 1024."
-  (declare (type (function () integer))
+  (declare (ftype (function () integer))
            (side-effect-free error-free))
   (let ((default-directory temporary-file-directory))
     (or (cdr (assq 'vsize (process-attributes (emacs-pid)))) 0)))
@@ -6492,7 +6492,7 @@ To test whether a function can be called interactively, use
 `commandp'."
   ;; Kept around for now.  See discussion at:
   ;; https://lists.gnu.org/r/emacs-devel/2020-08/msg00564.html
-  (declare (type (function () boolean))
+  (declare (ftype (function () boolean))
            (obsolete called-interactively-p "23.2")
            (side-effect-free error-free))
   (called-interactively-p 'interactive))
index 639090752be0dbf13cf6e5c8b9c06afeee081dad..8feeba0d83e8b089e83e8b436d03eb726b54b922 100644 (file)
@@ -2515,7 +2515,7 @@ have special meanings:
 
 Any other value of ALL-FRAMES means consider all windows on the
 selected frame and no others."
-  (declare (type (function (&optional t t t) (or window null)))
+  (declare (ftype (function (&optional t t t) (or window null)))
            (side-effect-free error-free))
   (let ((windows (window-list-1 nil 'nomini all-frames))
         best-window best-time second-best-window second-best-time time)
@@ -2595,7 +2595,7 @@ have special meanings:
 
 Any other value of ALL-FRAMES means consider all windows on the
 selected frame and no others."
-  (declare (type (function (&optional t t t) (or window null)))
+  (declare (ftype (function (&optional t t t) (or window null)))
            (side-effect-free error-free))
   (let ((best-size 0)
        best-window size)
@@ -4091,7 +4091,7 @@ with a special meaning are:
 
 Anything else means consider all windows on the selected frame
 and no others."
-  (declare (type (function (&optional t t) boolean))
+  (declare (ftype (function (&optional t t) boolean))
            (side-effect-free error-free))
   (let ((base-window (selected-window)))
     (if (and nomini (eq base-window (minibuffer-window)))