From: Nikodemus Siivola Date: Thu, 1 Dec 2011 11:30:41 +0000 (+0200) Subject: fix bug in typechecking calls with non-constant keywords X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=930e3879538d196aeb8c08e9d1b223f641f533d6;p=sbcl.git fix bug in typechecking calls with non-constant keywords Reported by Eric Marsden on sbcl-devel 2011-12-01. --- diff --git a/NEWS b/NEWS index 8790dd1..77b045c 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,8 @@ changes relative to sbcl-1.0.54: two different threads. Now a single deadlock is reported exactly once. * bug fix: interval-arithmetic division during type derivation did not account for signed zeros. + * bug fix: compiler error when typechecking a call to a function with + non-constant keyword arguments. changes in sbcl-1.0.54 relative to sbcl-1.0.53: * minor incompatible changes: diff --git a/src/compiler/ctype.lisp b/src/compiler/ctype.lisp index eddb7f1..dbc19f4 100644 --- a/src/compiler/ctype.lisp +++ b/src/compiler/ctype.lisp @@ -851,8 +851,10 @@ (let ((name (key-info-name key))) (do ((arg args (cddr arg))) ((null arg)) - (when (eq (lvar-value (first arg)) name) - (funcall fun (second arg) (key-info-type key)))))))) + (let ((keyname (first arg))) + (when (and (constant-lvar-p keyname) + (eq (lvar-value keyname) name)) + (funcall fun (second arg) (key-info-type key))))))))) ;;; Assert that CALL is to a function of the specified TYPE. It is ;;; assumed that the call is legal and has only constants in the diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index a8d0eea..eb60efd 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -4089,3 +4089,10 @@ (multiple-value-bind (q r) (funcall fun 0) (assert (eql -0d0 q)) (assert (eql 0d0 r))))) + +(with-test (:name :non-constant-keyword-typecheck) + (let ((fun (compile nil + `(lambda (p1 p3 p4) + (declare (type keyword p3)) + (tree-equal p1 (cons 1 2) (the (member :test) p3) p4))))) + (assert (funcall fun (cons 1.0 2.0) :test '=))))