X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcompiler%2Fctype.lisp;h=23cc3ce691f7fe98ecb708701890dccfdc215c98;hb=f31bc323d5bfc205f94164b203833f35033df3cd;hp=79278147987703b27af4d63c6aac34362a623a6c;hpb=203e466f5fbb3bffa7b4beb19d87bed6f8a1b5db;p=sbcl.git diff --git a/src/compiler/ctype.lisp b/src/compiler/ctype.lisp index 7927814..23cc3ce 100644 --- a/src/compiler/ctype.lisp +++ b/src/compiler/ctype.lisp @@ -616,7 +616,7 @@ (unless (optional-dispatch-keyp od) (frob (not (null (optional-dispatch-more-entry od))) (not (null (fun-type-rest type))) - "&REST arguments")) + "&REST argument")) (frob (optional-dispatch-allowp od) (fun-type-allowp type) "&ALLOW-OTHER-KEYS")) @@ -765,8 +765,9 @@ (type-specifier type)))) (t (setf (leaf-type var) type) - (dolist (ref (leaf-refs var)) - (derive-node-type ref (make-single-value-type type)))))) + (let ((s-type (make-single-value-type type))) + (dolist (ref (leaf-refs var)) + (derive-node-type ref s-type)))))) t)))))) ;;; FIXME: This is quite similar to ASSERT-NEW-DEFINITION. @@ -775,14 +776,36 @@ (let ((type (info :function :type name)) (where (info :function :where-from name))) (when (eq where :declared) - (setf (leaf-type fun) type) - (assert-definition-type - fun type - :unwinnage-fun #'compiler-notify - :where "proclamation" - :really-assert (not (awhen (info :function :info name) - (ir1-attributep (fun-info-attributes it) - explicit-check))))))) + (let ((type (massage-global-definition-type type fun))) + (setf (leaf-type fun) type) + (assert-definition-type + fun type + :unwinnage-fun #'compiler-notify + :where "proclamation" + :really-assert (not (awhen (info :function :info name) + (ir1-attributep (fun-info-attributes it) + explicit-check)))))))) + +;;; If the function has both &REST and &KEY, FIND-OPTIONAL-DISPATCH-TYPES +;;; doesn't complain about the type missing &REST -- which is good, because in +;;; that case &REST is really an implementation detail and not part of the +;;; interface. However since we set the leaf type missing &REST from there +;;; would be a bad thing -- to make up a new type if necessary. +(defun massage-global-definition-type (type fun) + (if (and (fun-type-p type) + (optional-dispatch-p fun) + (optional-dispatch-keyp fun) + (optional-dispatch-more-entry fun) + (not (or (fun-type-rest type) + (fun-type-wild-args type)))) + (make-fun-type :required (fun-type-required type) + :optional (fun-type-optional type) + :rest *universal-type* + :keyp (fun-type-keyp type) + :keywords (fun-type-keywords type) + :allowp (fun-type-allowp type) + :returns (fun-type-returns type)) + type)) ;;; Call FUN with (arg-lvar arg-type) (defun map-combination-args-and-types (fun call)