0.8.6.17:
authorChristophe Rhodes <csr21@cam.ac.uk>
Sun, 30 Nov 2003 15:19:34 +0000 (15:19 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Sun, 30 Nov 2003 15:19:34 +0000 (15:19 +0000)
Fix for bogus type warning (Rudi sbcl-devel 2003-09-21)
... I don't really know what I'm doing here.  Presumably
SLOTS could never be NIL at this point?  Bah.

src/pcl/vector.lisp
tests/compiler.test.sh
version.lisp-expr

index e6bfa4b..02bbe28 100644 (file)
        `(locally (declare #.*optimize-speed*)
          (let ((,index (pvref ,pv ,pv-offset)))
            (setq ,value (typecase ,index
+                          ;; FIXME: the line marked by KLUDGE below
+                          ;; (and the analogous spot in
+                          ;; INSTANCE-WRITE-INTERNAL) is there purely
+                          ;; to suppress a type mismatch warning that
+                          ;; propagates through to user code.
+                          ;; Presumably SLOTS at this point can never
+                          ;; actually be NIL, but the compiler seems
+                          ;; to think it could, so we put this here
+                          ;; to shut it up.  (see also mail Rudi
+                          ;; Schlatte sbcl-devel 2003-09-21) -- CSR,
+                          ;; 2003-11-30
                           ,@(when (or (null type) (eq type :instance))
-                              `((fixnum (clos-slots-ref ,slots ,index))))
+                              `((fixnum
+                                 (and ,slots ; KLUDGE
+                                  (clos-slots-ref ,slots ,index)))))
                           ,@(when (or (null type) (eq type :class))
                               `((cons (cdr ,index))))
                           (t +slot-unbound+)))
          (let ((,index (pvref ,pv ,pv-offset)))
            (typecase ,index
              ,@(when (or (null type) (eq type :instance))
-                      `((fixnum (setf (clos-slots-ref ,slots ,index)
-                                     ,new-value))))
+                  `((fixnum (and ,slots
+                            (setf (clos-slots-ref ,slots ,index)
+                                  ,new-value)))))
              ,@(when (or (null type) (eq type :class))
                  `((cons (setf (cdr ,index) ,new-value))))
              (t ,default)))))))
index 264f474..fd948bf 100644 (file)
@@ -130,6 +130,27 @@ cat > $tmpfilename <<EOF
 EOF
 fail_on_compiler_note $tmpfilename
 
+# test case from Rudi for some CLOS WARNINGness that shouldn't have
+# been there
+cat > $tmpfilename <<EOF
+    (eval-when (:compile-toplevel :load-toplevel :execute)
+      (defstruct buffer-state 
+        (output-index 0)))
+    
+    (defclass buffered-stream-mixin ()
+      ((buffer-state :initform (make-buffer-state))))
+    
+    (defgeneric frob (stream))
+    (defmethod frob ((stream t))
+      nil)
+    (defmethod frob ((stream buffered-stream-mixin))
+      (symbol-macrolet
+            ((index (buffer-state-output-index (slot-value stream 'buffer-state))))
+          (setf index 0))
+      (call-next-method))
+EOF
+expect_clean_compile $tmpfilename
+
 rm $tmpfilename
 rm $compiled_tmpfilename
 
index 8e708ae..6f2dbde 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.6.16"
+"0.8.6.17"