From: Nikodemus Siivola Date: Tue, 16 Aug 2011 11:26:28 +0000 (+0300) Subject: extend ARRAY-TYPE-UPGRADED-ELEMENT-TYPE to work with member types X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=97dd06859cae90c8ef9021dafe1beebb78b1547f;hp=f5907ea4f056a287022e4bce93c9b711b4133e5e;p=sbcl.git extend ARRAY-TYPE-UPGRADED-ELEMENT-TYPE to work with member types Fixes lp#826971. --- diff --git a/src/compiler/array-tran.lisp b/src/compiler/array-tran.lisp index 0610986..38defe4 100644 --- a/src/compiler/array-tran.lisp +++ b/src/compiler/array-tran.lisp @@ -98,6 +98,10 @@ (values element-type (when (eq *wild-type* element-type) (apply #'type-union element-supertypes))))) + (member-type + ;; Convert member-type to an union-type. + (array-type-upgraded-element-type + (apply #'type-union (mapcar #'ctype-of (member-type-members type))))) (t ;; KLUDGE: there is no good answer here, but at least ;; *wild-type* won't cause HAIRY-DATA-VECTOR-{REF,SET} to be diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index 28b6b7f..fa8da25 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -3979,3 +3979,9 @@ (declare (type (member -2 1) b)) (array-in-bounds-p a 4 b c))))) (assert (funcall fun (make-array '(5 2 2)) 1 1)))) + +(with-test (:name :bug-826971) + (let* ((foo "foo") + (fun (compile nil `(lambda (p1 p2) + (schar (the (eql ,foo) p1) p2))))) + (assert (eql #\f (funcall fun foo 0)))))