Of the following, BAR and ZOT exhibit the problem.
(defun bar (x &rest args) (declare (dynamic-extent args)) (values (the number x) (length args)))
(defun zot (x &rest args) (declare (dynamic-extent args)) (locally (declare (number x)) (values x (length args))))
(defun foo (x &rest args) (values (the number x) (length args)))
(defun quux (x &rest args) (declare (dynamic-extent args)) (declare (number x)) (values x (length args)))
(defun fii (x &rest args) (declare (dynamic-extent fii)) (if x (error "foo") (length args)))
Of the following, BAR and ZOT exhibit the problem.
(defun bar (x &rest args)
(declare (dynamic-extent args))
(values (the number x) (length args)))
(defun zot (x &rest args)
(declare (dynamic-extent args))
(locally
(declare (number x))
(values x (length args))))
(defun foo (x &rest args)
(values (the number x) (length args)))
(defun quux (x &rest args)
(declare (dynamic-extent args))
(declare (number x))
(values x (length args)))
(defun fii (x &rest args)
(declare (dynamic-extent fii))
(if x
(error "foo")
(length args)))