X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fclos.impure.lisp;h=e5cc14046c91e46398bd169339a95da3e9636a25;hb=68ea71d0f020f2726e3c56c1ec491d0af734b3a4;hp=f05a40ea3a691d87d44f6ae7fb0dce1e8aeafab1;hpb=60639facf7d4e266d729a9c89f333618c9b2e8e2;p=sbcl.git diff --git a/tests/clos.impure.lisp b/tests/clos.impure.lisp index f05a40e..e5cc140 100644 --- a/tests/clos.impure.lisp +++ b/tests/clos.impure.lisp @@ -1369,4 +1369,36 @@ (assert (equal '(result) (test-mc27prime 3))) (assert (raises-error? (test-mc27 t))) ; still no-applicable-method +;;; more invalid wrappers. This time for a long-standing bug in the +;;; compiler's expansion for TYPEP on various class-like things, with +;;; user-visible consequences. +(defclass obsolete-again () ()) +(defvar *obsolete-again* (make-instance 'obsolete-again)) +(defvar *obsolete-again-hash* (sxhash *obsolete-again*)) +(make-instances-obsolete (find-class 'obsolete-again)) +(assert (not (streamp *obsolete-again*))) +(make-instances-obsolete (find-class 'obsolete-again)) +(assert (= (sxhash *obsolete-again*) *obsolete-again-hash*)) +(compile (defun is-a-structure-object-p (x) (typep x 'structure-object))) +(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