-(defun sb!xc:proclaim (form)
- (unless (consp form)
- (error "malformed PROCLAIM spec: ~S" form))
- (let ((kind (first form))
- (args (rest form)))
+;;; ANSI defines the declaration (FOO X Y) to be equivalent to
+;;; (TYPE FOO X Y) when FOO is a type specifier. This function
+;;; implements that by converting (FOO X Y) to (TYPE FOO X Y).
+(defun canonized-decl-spec (decl-spec)
+ (let ((id (first decl-spec)))
+ (unless (symbolp id)
+ (error "The declaration identifier is not a symbol: ~S" id))
+ (let ((id-is-type (info :type :kind id))
+ (id-is-declared-decl (info :declaration :recognized id)))
+ (cond ((and id-is-type id-is-declared-decl)
+ (compiler-error
+ "ambiguous declaration ~S:~% ~
+ ~S was declared as a DECLARATION, but is also a type name."
+ decl-spec id))
+ (id-is-type
+ (cons 'type decl-spec))
+ (t
+ decl-spec)))))
+
+(defun sb!xc:proclaim (raw-form)
+ (let* ((form (canonized-decl-spec raw-form))
+ (kind (first form))
+ (args (rest form)))