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.
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*))))
(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