From: Andrea Corallo Date: Tue, 1 Sep 2020 19:28:22 +0000 (+0200) Subject: * lisp/emacs-lisp/cl-macs.el (cl-the): Emit compiler hints when native. X-Git-Tag: emacs-28.0.90~2727^2~443 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c4cc13917cdf733b142ed2dee9b5aee9df9f8153;p=emacs.git * lisp/emacs-lisp/cl-macs.el (cl-the): Emit compiler hints when native. --- diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index c38019d4a73..7adb9100703 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2329,6 +2329,14 @@ values. For compatibility, (cl-values A B C) is a synonym for (list A B C). (defmacro cl-the (type form) "Return FORM. If type-checking is enabled, assert that it is of TYPE." (declare (indent 1) (debug (cl-type-spec form))) + ;; When native compiling possibly add the appropriate type hint. + (when (and (boundp 'byte-native-compiling) + byte-native-compiling) + (setf form + (cl-case type + (fixnum `(comp-hint-fixnum ,form)) + (cons `(comp-hint-cons ,form)) + (otherwise form)))) (if (not (or (not (cl--compiling-file)) (< cl--optimize-speed 3) (= cl--optimize-safety 3)))