From 97dd06859cae90c8ef9021dafe1beebb78b1547f Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Tue, 16 Aug 2011 14:26:28 +0300 Subject: [PATCH] extend ARRAY-TYPE-UPGRADED-ELEMENT-TYPE to work with member types Fixes lp#826971. --- src/compiler/array-tran.lisp | 4 ++++ tests/compiler.pure.lisp | 6 ++++++ 2 files changed, 10 insertions(+) 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))))) -- 1.7.10.4