From 9ca5f2d431133c37793fff74e1ecbd229574222d Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Tue, 7 Jun 2011 20:02:15 +0300 Subject: [PATCH] minor bug in type= method for arrays of unknown element type 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 | 10 ++-------- tests/type.impure.lisp | 9 +++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/code/late-type.lisp b/src/code/late-type.lisp index 34b5f0d..56c8c79 100644 --- a/src/code/late-type.lisp +++ b/src/code/late-type.lisp @@ -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)) diff --git a/tests/type.impure.lisp b/tests/type.impure.lisp index a992a15..28479f0 100644 --- a/tests/type.impure.lisp +++ b/tests/type.impure.lisp @@ -723,4 +723,13 @@ (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 -- 1.7.10.4