-(declaim (ftype (function ((or symbol cons)) t) proclaim-as-function-name))
-(defun proclaim-as-function-name (name)
- (check-function-name name)
- (ecase (info :function :kind name)
- (:function
- (let ((accessor-for (info :function :accessor-for name)))
- (when accessor-for
- (compiler-style-warning
- "~@<The function ~
- ~2I~_~S ~
- ~I~_was previously defined as a slot accessor for ~
- ~2I~_~S.~:>"
- name
- accessor-for)
- (clear-info :function :accessor-for name))))
- (:macro
- (compiler-style-warning "~S was previously defined as a macro." name)
- (setf (info :function :where-from name) :assumed)
- (clear-info :function :macro-function name))
- ((nil)))
+(defun proclaim-as-fun-name (name)
+
+ ;; legal name?
+ (check-fun-name name)
+
+ ;; scrubbing old data I: possible collision with old definition
+ (when (fboundp name)
+ (ecase (info :function :kind name)
+ (:function) ; happy case
+ ((nil)) ; another happy case
+ (:macro ; maybe-not-so-good case
+ (compiler-style-warning "~S was previously defined as a macro." name)
+ (setf (info :function :where-from name) :assumed)
+ (clear-info :function :macro-function name))))
+
+ ;; scrubbing old data II: dangling forward references
+ ;;
+ ;; (This could happen if someone executes PROCLAIM FTYPE at
+ ;; macroexpansion time, which is bad style, or at compile time, e.g.
+ ;; in EVAL-WHEN (:COMPILE) inside something like DEFSTRUCT, in which
+ ;; case it's reasonable style. Either way, NAME is no longer a free
+ ;; function.)
+ (when (boundp '*free-functions*) ; when compiling
+ (remhash name *free-functions*))
+
+ ;; recording the ordinary case