From 8a19ff566e3a1a43cb3b2d11d2781a1c89981f43 Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Fri, 31 May 2013 16:27:11 +0400 Subject: [PATCH] Fix a regression in APPEND type derivation. 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 | 5 ++++- tests/compiler.pure.lisp | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/compiler/srctran.lisp b/src/compiler/srctran.lisp index ef9de86..80338ea 100644 --- a/src/compiler/srctran.lisp +++ b/src/compiler/srctran.lisp @@ -178,7 +178,10 @@ 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*)))) diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index 3e949b3..f30c809 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -4408,6 +4408,8 @@ (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 -- 1.7.10.4