From: Christophe Rhodes Date: Sun, 27 Jul 2003 15:24:11 +0000 (+0000) Subject: 0.8.2.4: X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=dc78da1842ccba35e49ca8ca91fd0ab88b1a08b3;p=sbcl.git 0.8.2.4: As reported by pfdietz sbcl-devel 2003-07-27, MAKE-SEQUENCE, MERGE and CONCATENATE weren't inferring their return type aggressively enough when given VECTOR as the type specifier. --- diff --git a/src/code/early-type.lisp b/src/code/early-type.lisp index bbb75ba..6679a42 100644 --- a/src/code/early-type.lisp +++ b/src/code/early-type.lisp @@ -335,7 +335,7 @@ :enumerable enumerable)) ;;; An ARRAY-TYPE is used to represent any array type, including -;;; things such as SIMPLE-STRING. +;;; things such as SIMPLE-BASE-STRING. (defstruct (array-type (:include ctype (class-info (type-class-or-lose 'array))) (:constructor %make-array-type) diff --git a/src/compiler/knownfun.lisp b/src/compiler/knownfun.lisp index d28f79e..8d96138 100644 --- a/src/compiler/knownfun.lisp +++ b/src/compiler/knownfun.lisp @@ -272,7 +272,8 @@ ;;; Derive the type to be the type specifier which is the Nth arg, ;;; with the additional restriptions noted in the CLHS for STRING and -;;; SIMPLE-STRING. +;;; SIMPLE-STRING, defined to specialize on CHARACTER, and for VECTOR +;;; (under the page for MAKE-SEQUENCE). (defun creation-result-type-specifier-nth-arg (n) (lambda (call) (declare (type combination call)) @@ -293,6 +294,20 @@ (declare (ignore simple-string)) (careful-specifier-type `(simple-array character ,@(if size (list size) '((*))))))) - (t (careful-specifier-type specifier)))))))) + (t + (let ((ctype (careful-specifier-type specifier))) + (if (and (array-type-p ctype) + (eq (array-type-specialized-element-type ctype) + *wild-type*)) + ;; I don't think I'm allowed to modify what I get + ;; back from SPECIFIER-TYPE; it is, after all, + ;; cached. Better copy it, then. + (let ((real-ctype (copy-structure ctype))) + (setf (array-type-element-type real-ctype) + *universal-type* + (array-type-specialized-element-type real-ctype) + *universal-type*) + real-ctype) + ctype))))))))) (/show0 "knownfun.lisp end of file") diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index d2e81c8..5066830 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -446,8 +446,8 @@ (declare (notinline mapcar)) (1+ (mapcar #'print '(1 2 3))))))) -;; bug found by Paul Dietz: (SETF AREF) for bit vectors with constant -;; index was effectless +;;; bug found by Paul Dietz: (SETF AREF) for bit vectors with constant +;;; index was effectless (let ((f (compile nil '(lambda (a v) (declare (type simple-bit-vector a) (type bit v)) (declare (optimize (speed 3) (safety 0))) @@ -463,7 +463,7 @@ (declare (type (simple-array (simple-string 3) (5)) x)) (aref (aref x 0) 0)))) -;; compiler failure +;;; compiler failure (let ((f (compile nil '(lambda (x) (typep x '(not (member 0d0))))))) (assert (funcall f 1d0))) @@ -472,7 +472,7 @@ (let ((y (* x pi))) (atan y y)))) -;; bogus optimization of BIT-NOT +;;; bogus optimization of BIT-NOT (multiple-value-bind (result x) (eval '(let ((x (eval #*1001))) (declare (optimize (speed 2) (space 3)) @@ -480,3 +480,14 @@ (values (bit-not x nil) x))) (assert (equal x #*1001)) (assert (equal result #*0110))) + +;;; the VECTOR type in CONCATENATE/MERGE/MAKE-SEQUENCE means (VECTOR T). +(handler-bind ((sb-ext:compiler-note #'error)) + (assert (equalp (funcall + (compile + nil + '(lambda () + (let ((x (make-sequence 'vector 10 :initial-element 'a))) + (setf (aref x 4) 'b) + x)))) + #(a a a a b a a a a a)))) diff --git a/version.lisp-expr b/version.lisp-expr index 865410d..9d2518b 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.8.2.3" +"0.8.2.4"