I wrote:

>(foo1):
>               (defun foo (&key (test #'oddp))
>                 (remove-if #'(lambda (x)
>                                       (apply test (list x)))
>                  nil))
>  
>
In this case, it seems that the compile error can be avoided
by replacing    (apply test (list ...))
with                 (funcall test ...).
As a workaround, that's fine for me, but I still think there is a
bug in the compiler.

>(foo2):
>               (defun foo ()
>                 (let (a)
>                  (declare (type (simple-array list 1) a))
>                  (mapc #'(lambda (x)
>                                  (bar a))
>                   nil)))
>
>The second error can be fixed easily by quoting the list symbol
>in the type declaration, but the first one is non-obvious to me.
>  
>
As Christophe Rhodes kindly pointed out, quoting the list symbol
is the wrong solution; the right fix is to widen the type declaration
to (or ... null).
In my case, there was even some variable initialization code
(setq a (make-array ...)) after the type declaration (but not
included it in the above example because it was not necessary
to trigger the error), and moving it into the var initialization
part of the let construct (and thus before the type declaration)
made the error go away, too.  Anyway, for me all problems
are solved for now.

Thanks,
Andreas


Reply via email to