When a driver variable has a type declaration, we get a spurious warning
This issue is demonstrated by a new test that I have written:
;;; this test catches problems with make-initial-value, which cannot find a good initial ;;; value for cases where the initial value should be NIL. This causes generation of a ;;; spurious warning. (deftest type.8 (catch 'warned (handler-bind ((simple-warning #'(lambda (w) (throw 'warned (format nil "~a" w)))) (error #'(lambda (w) (throw 'warned (format nil "~a" w))))) (let ((vec (vector (make-instance 'polar :mag 2) (make-instance 'polar :mag 4)))) (nth-value 1 (iter (for x in-vector vec with-index i) (declare (type (or null polar) x) (type fixnum i)) (with-slots (rho) x (finding x such-that (= rho 4) into target)) (finally (return (values target i)))))))) 1)
Expected value: 1 Actual value: "Iterate, in clause (FOR X IN-VECTOR VEC WITH-INDEX I): Cannot supply an initial value for type (OR NULL POLAR); using NIL.".
... which clearly shows the problem --
NIL is a perfectly fine initial value for type
(OR NULL POLAR).
I believe I have a patch that fixes this. Will post a MR ASAP.