extend ARRAY-TYPE-UPGRADED-ELEMENT-TYPE to work with member types
authorNikodemus Siivola <nikodemus@random-state.net>
Tue, 16 Aug 2011 11:26:28 +0000 (14:26 +0300)
committerNikodemus Siivola <nikodemus@random-state.net>
Mon, 22 Aug 2011 11:17:38 +0000 (14:17 +0300)
 Fixes lp#826971.

src/compiler/array-tran.lisp
tests/compiler.pure.lisp

index 0610986..38defe4 100644 (file)
        (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
index 28b6b7f..fa8da25 100644 (file)
                              (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)))))