Fix a regression in APPEND type derivation.
authorStas Boukarev <stassats@gmail.com>
Fri, 31 May 2013 12:27:11 +0000 (16:27 +0400)
committerStas Boukarev <stassats@gmail.com>
Fri, 31 May 2013 12:27:11 +0000 (16:27 +0400)
Do not just test the arguments for validity by being subtypes or
supertypes of LIST, but also if it's a subytpe of NULL, since ATOM or
SYMBOL won't satisfy the LIST tests.

Regression since f32ee7d.."Better type derivation for APPEND, NCONC,
LIST.", reported by Eric Marsden.

src/compiler/srctran.lisp
tests/compiler.pure.lisp

index ef9de86..80338ea 100644 (file)
                   do
                   (let ((lvar-type (lvar-type arg)))
                     (unless (or (csubtypep list-type lvar-type)
-                                (csubtypep lvar-type list-type))
+                                (csubtypep lvar-type list-type)
+                                ;; Check for NIL specifically, because
+                                ;; SYMBOL or ATOM won't satisfie the above
+                                (csubtypep null-type lvar-type))
                       (assert-lvar-type arg list-type
                                         (lexenv-policy *lexenv*))
                       (return *empty-type*))))
index 3e949b3..f30c809 100644 (file)
             (lambda (x) (append x (cons 1 2))) cons
             (lambda (x y) (append x (cons 1 2) y)) cons
             (lambda (x y) (nconc x (the list y) x)) t
+            (lambda (x y) (nconc (the atom x) y)) t
+            (lambda (x y) (nconc (the (or null (eql 10)) x) y)) t
             (lambda (x y) (print (length y)) (append x y)) sequence)))
     (loop for (function result-type) on test-cases by #'cddr
           do (assert (equal (car (cdaddr (sb-kernel:%simple-fun-type