X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fcompiler.pure-cload.lisp;h=3f913cf274e01f881e996cf1fb2782df02e4a91c;hb=fe240ce504041bfb181a81cb11b7b4bba112f65f;hp=8c7dd8eb2d710c8bbedf90f2496df5ee460870a9;hpb=4a4f1e5ca70363d64d7cbb141863a387334e6760;p=sbcl.git diff --git a/tests/compiler.pure-cload.lisp b/tests/compiler.pure-cload.lisp index 8c7dd8e..3f913cf 100644 --- a/tests/compiler.pure-cload.lisp +++ b/tests/compiler.pure-cload.lisp @@ -20,3 +20,42 @@ (declare (type (mod 1000) a b)) (let ((tmp (= 10 (+ (incf a) (incf a) (incf b) (incf b))))) (or tmp (error "TMP not true")))) + +;;; Exercise a (byte-)compiler bug by causing a call to ERROR, not +;;; because the symbol isn't defined as a variable, but because +;;; TYPE-ERROR in SB-KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER: +;;; 0 is not of type (OR FUNCTION SB-KERNEL:FDEFN). +;;; Correct behavior is to warn at compile time because the symbol +;;; isn't declared as a variable, but to set its SYMBOL-VALUE anyway. +;;; +;;; This bug was in sbcl-0.6.11.13. +(print (setq improperly-declared-var '(1 2))) +(assert (equal (symbol-value 'improperly-declared-var) '(1 2))) +(makunbound 'improperly-declared-var) +;;; This is a slightly different way of getting the same symptoms out +;;; of the sbcl-0.6.11.13 byte compiler bug. +(print (setq *print-level* *print-level*)) + +;;; PROGV with different numbers of variables and values +(let ((a 1)) + (declare (special a)) + (assert (equal (list a (progv '(a b) '(:a :b :c) + (assert (eq (symbol-value 'nil) nil)) + (list (symbol-value 'a) (symbol-value 'b))) + a) + '(1 (:a :b) 1))) + (assert (equal (list a (progv '(a b) '(:a :b) + (assert (eq (symbol-value 'nil) nil)) + (list (symbol-value 'a) (symbol-value 'b))) + a) + '(1 (:a :b) 1))) + (assert (not (boundp 'b)))) + +(let ((a 1) (b 2)) + (declare (special a b)) + (assert (equal (list a b (progv '(a b) '(:a) + (assert (eq (symbol-value 'nil) nil)) + (assert (not (boundp 'b))) + (symbol-value 'a)) + a b) + '(1 2 :a 1 2))))