X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fcompiler-1.impure-cload.lisp;h=4d5b1047dc6493cda50238a59dd070e3213e314c;hb=caf8bb05a82659e688c125b418783bc8a3bd2be8;hp=cdad366eff6237ee7af6bbc63936f99a9032fcde;hpb=e47ffa8855d4139f88f5982fe4b82a05c3498ed3;p=sbcl.git diff --git a/tests/compiler-1.impure-cload.lisp b/tests/compiler-1.impure-cload.lisp index cdad366..4d5b104 100644 --- a/tests/compiler-1.impure-cload.lisp +++ b/tests/compiler-1.impure-cload.lisp @@ -14,6 +14,10 @@ (cl:in-package :cl-user) +(eval-when (:compile-toplevel :load-toplevel :execute) + (load "assertoid") + (use-package "ASSERTOID")) + (declaim (optimize (debug 3) (speed 2) (space 1))) ;;; Until version 0.6.9 or so, SBCL's version of Python couldn't do @@ -172,5 +176,20 @@ (t (safe-format t "~&baz ~S (~A) ~S" condition condition result))))))) -(sb-ext:quit :unix-status 104) ; success +;;; bug 231: SETQ did not check the type of the variable being set +(defun bug231-1 (x) + (declare (optimize safety) (type (integer 0 8) x)) + (incf x)) +(assert (raises-error? (bug231-1 8) type-error)) + +(defun bug231-2 (x) + (declare (optimize safety) (type (integer 0 8) x)) + (list (lambda (y) (setq x y)) + (lambda () x))) +(destructuring-bind (set get) (bug231-2 0) + (funcall set 8) + (assert (eql (funcall get) 8)) + (assert (raises-error? (funcall set 9) type-error)) + (assert (eql (funcall get) 8))) +(sb-ext:quit :unix-status 104) ; success