fix bug in typechecking calls with non-constant keywords
authorNikodemus Siivola <nikodemus@random-state.net>
Thu, 1 Dec 2011 11:30:41 +0000 (13:30 +0200)
committerNikodemus Siivola <nikodemus@random-state.net>
Mon, 5 Dec 2011 09:28:01 +0000 (11:28 +0200)
 Reported by Eric Marsden on sbcl-devel 2011-12-01.

NEWS
src/compiler/ctype.lisp
tests/compiler.pure.lisp

diff --git a/NEWS b/NEWS
index 8790dd1..77b045c 100644 (file)
--- 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:
index eddb7f1..dbc19f4 100644 (file)
       (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
index a8d0eea..eb60efd 100644 (file)
     (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 '=))))