minor bug in type= method for arrays of unknown element type
authorNikodemus Siivola <nikodemus@sb-studio.net>
Tue, 7 Jun 2011 17:02:15 +0000 (20:02 +0300)
committerNikodemus Siivola <nikodemus@sb-studio.net>
Tue, 7 Jun 2011 17:07:58 +0000 (20:07 +0300)
 If the type has been specified since our last encounter with it,
 reparsing the previously unknown type specifier can result in TYPE=
 saying NIL, T.

 Hard to provoke without dipping into internals, so no NEWS entry.

src/code/late-type.lisp
tests/type.impure.lisp

index 34b5f0d..56c8c79 100644 (file)
@@ -2403,14 +2403,8 @@ used for a COMPLEX component.~:@>"
          (values nil t))
         ((or (unknown-type-p (array-type-element-type type1))
              (unknown-type-p (array-type-element-type type2)))
-         (multiple-value-bind (equalp certainp)
-             (type= (array-type-element-type type1)
-                    (array-type-element-type type2))
-           ;; By its nature, the call to TYPE= should never return
-           ;; NIL, T, as we don't know what the UNKNOWN-TYPE will grow
-           ;; up to be.  -- CSR, 2002-08-19
-           (aver (not (and (not equalp) certainp)))
-           (values equalp certainp)))
+         (type= (array-type-element-type type1)
+                (array-type-element-type type2)))
         (t
          (values (type= (array-type-specialized-element-type type1)
                         (array-type-specialized-element-type type2))
index a992a15..28479f0 100644 (file)
     (multiple-value-bind (ok sure) (sb-kernel:csubtypep t1 t2)
       (assert (and ok sure)))))
 
+(with-test (:name :unknown-type-not=-for-sure)
+  (let* ((type (gensym "FOO"))
+         (spec1 (sb-kernel:specifier-type `(vector ,type)))
+         (spec2 (sb-kernel:specifier-type `(vector single-float))))
+    (eval `(deftype ,type () 'double-float))
+    (multiple-value-bind (ok sure) (sb-kernel:type= spec1 spec2)
+      (assert (not ok))
+      (assert sure))))
+
 ;;; success