aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Corallo2020-12-29 19:41:28 +0100
committerAndrea Corallo2020-12-30 14:03:46 +0100
commit0593f478762437e2a8618f3f874a26424e4590b4 (patch)
treef5c6c0f49c9f8a5892b7b3de0dca10b2f7540618
parent3f00d666e9674ba18f1ded490a27ac2868a32a88 (diff)
downloademacs-0593f478762437e2a8618f3f874a26424e4590b4.tar.gz
emacs-0593f478762437e2a8618f3f874a26424e4590b4.zip
* Add more function type specifiers
* lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Add more type specifiers.
-rw-r--r--lisp/emacs-lisp/comp.el244
1 files changed, 239 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index bf266256f70..7e5a9ec951c 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -184,7 +184,11 @@ Useful to hook into pass checkers.")
184 184
185;; FIXME this probably should not be here but... good for now. 185;; FIXME this probably should not be here but... good for now.
186(defconst comp-known-type-specifiers 186(defconst comp-known-type-specifiers
187 `((cons (function (t t) cons)) 187 `(
188 ;; pure-fns
189 (cons (function (t t) cons))
190 (car (function (list) t))
191 (cdr (function (list) t))
188 (1+ (function ((or number marker)) number)) 192 (1+ (function ((or number marker)) number))
189 (1- (function ((or number marker)) number)) 193 (1- (function ((or number marker)) number))
190 (+ (function (&rest (or number marker)) number)) 194 (+ (function (&rest (or number marker)) number))
@@ -194,7 +198,7 @@ Useful to hook into pass checkers.")
194 (% (function ((or number marker) (or number marker)) number)) 198 (% (function ((or number marker) (or number marker)) number))
195 (concat (function (&rest sequence) string)) 199 (concat (function (&rest sequence) string))
196 (regexp-opt (function (list) string)) 200 (regexp-opt (function (list) string))
197 (string-to-char (function (string) integer)) 201 (string-to-char (function (string) fixnum))
198 (symbol-name (function (symbol) string)) 202 (symbol-name (function (symbol) string))
199 (eq (function (t t) boolean)) 203 (eq (function (t t) boolean))
200 (eql (function (t t) boolean)) 204 (eql (function (t t) boolean))
@@ -234,16 +238,15 @@ Useful to hook into pass checkers.")
234 (string< (function ((or string symbol) (or string symbol)) boolean)) 238 (string< (function ((or string symbol) (or string symbol)) boolean))
235 (string-lessp (function ((or string symbol) (or string symbol)) boolean)) 239 (string-lessp (function ((or string symbol) (or string symbol)) boolean))
236 (string-search (function (string string &optional integer) integer)) 240 (string-search (function (string string &optional integer) integer))
237 (string-to-char (function (string) integer))
238 (string-to-number (function (string &optional integer) number)) 241 (string-to-number (function (string &optional integer) number))
239 (string-to-syntax (function (string) cons)) 242 (string-to-syntax (function (string) cons))
240 (substring (function ((or string vector) &optional integer integer) (or string vector))) 243 (substring (function ((or string vector) &optional integer integer)
244 (or string vector)))
241 (sxhash (function (t) integer)) 245 (sxhash (function (t) integer))
242 (sxhash-equal (function (t) integer)) 246 (sxhash-equal (function (t) integer))
243 (sxhash-eq (function (t) integer)) 247 (sxhash-eq (function (t) integer))
244 (sxhash-eql (function (t) integer)) 248 (sxhash-eql (function (t) integer))
245 (symbol-function (function (symbol) t)) 249 (symbol-function (function (symbol) t))
246 (symbol-name (function (symbol) string))
247 (symbol-plist (function (symbol) list)) 250 (symbol-plist (function (symbol) list))
248 (symbol-value (function (symbol) t)) 251 (symbol-value (function (symbol) t))
249 (string-make-unibyte (function (string) string)) 252 (string-make-unibyte (function (string) string))
@@ -262,6 +265,237 @@ Useful to hook into pass checkers.")
262 (vconcat (function (&rest sequence) vector)) 265 (vconcat (function (&rest sequence) vector))
263 ;; TODO all window-* :x 266 ;; TODO all window-* :x
264 (zerop (function (number) boolean)) 267 (zerop (function (number) boolean))
268 ;; side-effect-free-fns
269 (acos (function (number) float))
270 (append (function (&rest list) list))
271 (asin (function (number) float))
272 (atan (function (number &optional number) float))
273 (boundp (function (symbol) boolean))
274 (buffer-file-name (function (&optional buffer) string))
275 (buffer-local-variables (function (&optional buffer) list))
276 (buffer-modified-p (function (&optional buffer) boolean))
277 (buffer-substring (function ((or integer marker) (or integer marker)) string))
278 (byte-code-function-p (function (t) boolean))
279 (capitalize (function (or integer string) (or integer string)))
280 (car-less-than-car (function (list list) boolean))
281 (char-after (function (&optional (or marker integer)) fixnum))
282 (char-before (function (&optional (or marker integer)) fixnum))
283 (char-equal (function (integer integer) boolean))
284 (char-to-string (function (fixnum) string))
285 (char-width (function (fixnum) fixnum))
286 (compare-strings (function (string (or integer marker null)
287 (or integer marker null)
288 string (or integer marker null)
289 (or integer marker null)
290 &optional t)
291 (or (member t) fixnum)))
292 (coordinates-in-window-p (function (cons window) boolean))
293 (copy-alist (function (list) list))
294 (copy-sequence (function (sequence) sequence))
295 (copy-marker (function (&optional (or integer marker) boolean) marker))
296 (cos (function (number) float))
297 (count-lines (function ((or integer marker) (or integer marker) &optional t)
298 integer))
299 (current-time-string (function (&optional string boolean) string))
300 (current-time-zone (function (&optional string boolean) cons))
301 (decode-char (function (cons t) (or fixnum null)))
302 (decode-time (function (&optional string symbol symbol) cons))
303 (default-boundp (function (symbol) boolean))
304 (default-value (function (symbol) t))
305 (documentation (function ((or function symbol subr) &optional t)
306 (or null string)))
307 (downcase (function ((or fixnum string)) (or fixnum string)))
308 (encode-char (function (fixnum symbol) (or fixnum null)))
309 (exp (function (number) float))
310 (expt (function (number number) float))
311 (encode-time (function (cons &rest t) cons))
312 (error-message-string (function (list) string))
313 (fboundp (function (symbol) boolean))
314 (featurep (function (symbol &optional symbol) boolean))
315 (file-directory-p (function (string) boolean))
316 (file-exists-p (function (string) boolean))
317 (file-locked-p (function (string) boolean))
318 (file-name-absolute-p (function (string) boolean))
319 (file-newer-than-file-p (function (string string) boolean))
320 (file-readable-p (function (string) boolean))
321 (file-symlink-p (function (string) boolean))
322 (file-writable-p (function (string) boolean))
323 (float-time (function (&optional cons) float))
324 (format (function (string &rest t) string))
325 (format-time-string (function (string &optional cons symbol) string))
326 (frame-first-window (function ((or frame window)) window))
327 (frame-root-window (function (&optional (or frame window)) window))
328 (frame-selected-window (function (&optional (or frame window)) window))
329 (frame-visible-p (function (frame) boolean))
330 (get (function (symbol symbol) t))
331 (gethash (function (t hash-table &optional t) t))
332 (get-buffer (function ((or buffer string)) (or buffer null)))
333 (get-buffer-window (function (&optional (or buffer string)
334 (or symbol (integer 0 0)))
335 (or null window)))
336 (getenv (function (string &optional frame) (or null string)))
337 (get-file-buffer (function (string) (or null buffer)))
338 (hash-table-count (function (hash-table) integer))
339 (int-to-string (function (number) string))
340 (intern-soft (function (string &optional vector) symbol))
341 (keymap-parent (function (cons) (or cons null)))
342 (length< (function (sequence fixnum) boolean))
343 (length> (function (sequence fixnum) boolean))
344 (length= (function (sequence fixnum) boolean))
345 (line-beginning-position (function (&optional integer) integer))
346 (line-end-position (function (&optional integer) integer))
347 (local-variable-if-set-p (function (symbol &optional buffer) boolean))
348 (local-variable-p (function (symbol &optional buffer) boolean))
349 (locale-info (function ((member codeset days months paper))
350 (or null string)))
351 (log (function (number number) float))
352 (log10 (function (number) float))
353 ;; (lsh (function ((integer ,most-negative-fixnum *) integer) integer)) ?
354 (lsh (function (integer integer) integer))
355 (make-byte-code (function ((or fixnum list) string vector integer &optional
356 string t &rest t)
357 vector))
358 (make-list (function (integer t) list))
359 (make-string (function (integer fixnum &optional t) string))
360 (make-symbol (function (string) symbol))
361 (marker-buffer (function (marker) buffer))
362 (minibuffer-selected-window (function () window))
363 (minibuffer-window (function (&optional frame) window))
364 (multibyte-char-to-unibyte (function (fixnum) fixnum))
365 (next-window (function (&optional window t t) window))
366 (number-to-string (function (number) string))
367 (parse-colon-path (function (string) cons))
368 (previous-window (function (&optional window t t) window))
369 (prin1-to-string (function (t &optional t) string))
370 (propertize (function (string &rest t) string))
371 (degrees-to-radians (function (number) float))
372 (radians-to-degrees (function (number) float))
373 (read-from-string (function (string &ptional integer integer) cons))
374 (region-beginning (function () integer))
375 (region-end (function () integer))
376 (reverse (function (sequence) sequence))
377 (sin (function (number) float))
378 (string (function (&rest fixnum) strng))
379 (get-largest-window (function (&optional t t t) window))
380 (get-lru-window (function (&optional t t t) window))
381 (one-window-p (function (&optional t t) boolean))
382 (regexp-quote (function (string) string))
383 (proper-list-p (function (t) integer))
384 (nth (function (integer list) t))
385 (nthcdr (function (integer list) list))
386 (last (function (list &optional integer) list))
387 (length (function (sequence) integer))
388 (memq (function (t list) list))
389 (memql (function (t list) list))
390 (member (function (t list) list))
391 (assq (function (t list) list))
392 (rassq (function (t list) list))
393 (rassoc (function (t list) list))
394 (plist-get (function (list t) t))
395 (lax-plist-get (function (list t) t))
396 (plist-member (function (list t) list))
397 (aref (function (array fixnum) t))
398 (elt (function (sequence integer) t))
399 (bool-vector-subsetp (function (bool-vector bool-vector) boolean))
400 (bool-vector-not (function (bool-vector &optional bool-vector) bool-vector))
401 (bool-vector-count-population (function (bool-vector) fixnum))
402 (bool-vector-count-consecutive (function (bool-vector bool-vector integer)
403 fixnum))
404 ;; side-effect-and-error-free-fns
405 (arrayp (function (t) boolean))
406 (atom (function (t) boolean))
407 (bignump (function (t) boolean))
408 (bobp (function () boolean))
409 (bolp (function () boolean))
410 (bool-vector-p (function (t) boolean))
411 (buffer-end (function ((or number marker)) integer))
412 (buffer-list (function (&optional frame) list))
413 (buffer-size (function (&optional buffer) integer))
414 (buffer-string (function () string))
415 (bufferp (function (t) boolean))
416 (car-safe (function (t) t))
417 (case-table-p (function (t) boolean))
418 (cdr-safe (function (t) t))
419 (char-or-string-p (function (t) boolean))
420 (characterp (function (t &optional t) boolean))
421 (charsetp (function (t) boolean))
422 (commandp (function (t &optional t) boolean))
423 (consp (function (t) boolean))
424 (current-buffer (function () buffer))
425 (current-global-map (function () cons))
426 (current-indentation (function () integer))
427 (current-local-map (function () cons))
428 (current-minor-mode-maps (function () cons))
429 (current-time (function () cons))
430 (eobp (function () boolean))
431 (eolp (function () boolean))
432 (equal (function (t t) boolean))
433 (eventp (function (t) boolean))
434 (fixnump (function (t) boolean))
435 (floatp (function (t) boolean))
436 (following-char (function () fixnum))
437 (framep (function (t) boolean))
438 (hash-table-p (function (t) boolean))
439 (identity (function (t) t))
440 (ignore (function (&rest t) null))
441 (integerp (function (t) boolean))
442 (integer-or-marker-p (function (t) boolean))
443 (interactive-p (function () boolean))
444 (invocation-directory (function () string))
445 (invocation-name (function () string))
446 (keymapp (function (t) boolean))
447 (keywordp (function (t) boolean))
448 (list (function (&rest t) list))
449 (listp (function (t) boolean))
450 (make-marker (function () marker))
451 (mark (function (&optional t) (or integer null)))
452 (mark-marker (function () marker))
453 (markerp (function (t) boolean))
454 (max-char (function () fixnum))
455 (memory-limit (function () integer))
456 (mouse-movement-p (function (t) boolean))
457 (natnump (function (t) boolean))
458 (nlistp (function (t) boolean))
459 (not (function (t) boolean))
460 (null (function (t) boolean))
461 (number-or-marker-p (function (t) boolean))
462 (numberp (function (t) boolean))
463 (overlayp (function (t) boolean))
464 (point (function () integer))
465 (point-marker (function () marker))
466 (point-min (function () integer))
467 (point-max (function () integer))
468 (preceding-char (function () fixnum))
469 (processp (function (t) boolean))
470 (recent-keys (function (&optional (or cons null)) vector))
471 (recursion-depth (function () integer))
472 (safe-length (function (t) integer))
473 (selected-frame (function () frame))
474 (selected-window (function () window))
475 (sequencep (function (t) boolean))
476 (standard-case-table (function () char-table))
477 (standard-syntax-table (function () char-table))
478 (stringp (function (t) boolean))
479 (subrp (function (t) boolean))
480 (symbolp (function (t) boolean))
481 (syntax-table (function () char-table))
482 (syntax-table-p (function (t) boolean))
483 (this-command-keys (function () string))
484 (this-command-keys-vector (function () vector))
485 (this-single-command-keys (function () vector))
486 (this-single-command-raw-keys (function () vector))
487 (type-of (function (t) symbol))
488 (user-real-login-name (function () string))
489 (user-real-uid (function () integer))
490 (user-uid (function () integer))
491 (vector (function (&rest t) vector))
492 (vectorp (function (t) boolean))
493 (visible-frame-list (function () list))
494 (wholenump (function (t) boolean))
495 (window-configuration-p (function (t) boolean))
496 (window-live-p (function (t) boolean))
497 (window-valid-p (function (t) boolean))
498 (windowp (function (t) boolean))
265 ;; Type hints 499 ;; Type hints
266 (comp-hint-fixnum (function (t) fixnum)) 500 (comp-hint-fixnum (function (t) fixnum))
267 (comp-hint-cons (function (t) cons)) 501 (comp-hint-cons (function (t) cons))