X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fclos.impure.lisp;h=e5cc14046c91e46398bd169339a95da3e9636a25;hb=23c0c48f562d7dc5d1615bf13cb831b46c91d106;hp=84c7ec33a1e83f106f65fb2a2575b2b222a191cb;hpb=8aa1742a4cf5fb4752148ace41a779482b195bd4;p=sbcl.git diff --git a/tests/clos.impure.lisp b/tests/clos.impure.lisp index 84c7ec3..e5cc140 100644 --- a/tests/clos.impure.lisp +++ b/tests/clos.impure.lisp @@ -1383,4 +1383,22 @@ (make-instances-obsolete (find-class 'obsolete-again)) (assert (not (is-a-structure-object-p *obsolete-again*))) +;;; overeager optimization of slot-valuish things +(defclass listoid () + ((caroid :initarg :caroid) + (cdroid :initarg :cdroid :initform nil))) +(defmethod lengthoid ((x listoid)) + (let ((result 0)) + (loop until (null x) + do (incf result) (setq x (slot-value x 'cdroid))) + result)) +(with-test (:name ((:setq :method-parameter) slot-value) :fails-on :sbcl) + (assert (= (lengthoid (make-instance 'listoid)) 1)) + (error "the failure mode is an infinite loop") + (assert (= (lengthoid + (make-instance 'listoid :cdroid + (make-instance 'listoid :cdroid + (make-instance 'listoid)))) + 3))) + ;;;; success