Function: cl-check-type

cl-check-type is an autoloaded macro defined in cl-macs.el.gz.

Signature

(cl-check-type FORM TYPE &optional STRING)

Documentation

Verify that FORM is of type TYPE; signal an error if not.

STRING is an optional description of the desired type.

View in manual

Aliases

check-type (obsolete since 27.1)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-macs.el.gz
;;;###autoload
(defmacro cl-check-type (form type &optional string)
  "Verify that FORM is of type TYPE; signal an error if not.
STRING is an optional description of the desired type."
  (declare (debug (place cl-type-spec &optional stringp)))
  (and (or (not (macroexp-compiling-p))
	   (< cl--optimize-speed 3) (= cl--optimize-safety 3))
       (macroexp-let2 macroexp-copyable-p temp form
         `(progn (or (cl-typep ,temp ',type)
                     (signal 'wrong-type-argument
                             (list ,(or string `',(if (eq 'satisfies
                                                          (car-safe type))
                                                      (cadr type) type))
                                   ,temp ',form)))
                 nil))))