X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fcompiler-1.impure-cload.lisp;h=a608dc8ac0a2373fc1b5c52a0ff579df3a43cf5a;hb=98f3f617894ce24a40764aa98606ce68c5482cf0;hp=8bc82bf86a7d825303566d464113c91928ddc488;hpb=71985ecfdc880e6c11a191d799313de9b4e0c12b;p=sbcl.git diff --git a/tests/compiler-1.impure-cload.lisp b/tests/compiler-1.impure-cload.lisp index 8bc82bf..a608dc8 100644 --- a/tests/compiler-1.impure-cload.lisp +++ b/tests/compiler-1.impure-cload.lisp @@ -14,8 +14,9 @@ (cl:in-package :cl-user) -(load "assertoid") -(use-package "ASSERTOID") +(eval-when (:compile-toplevel :load-toplevel :execute) + (load "assertoid") + (use-package "ASSERTOID")) (declaim (optimize (debug 3) (speed 2) (space 1))) @@ -176,19 +177,29 @@ (safe-format t "~&baz ~S (~A) ~S" condition condition result))))))) ;;; bug 231: SETQ did not check the type of the variable being set -(defun bug231-1 (x) +(defun bug231a-1 (x) (declare (optimize safety) (type (integer 0 8) x)) (incf x)) -(assert (raises-error? (bug231-1 8) type-error)) +(assert (raises-error? (bug231a-1 8) type-error)) -(defun bug231-2 (x) +(defun bug231a-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) +(destructuring-bind (set get) (bug231a-2 0) (funcall set 8) (assert (eql (funcall get) 8)) (assert (raises-error? (funcall set 9) type-error)) (assert (eql (funcall get) 8))) +(defun bug231b (x z) + (declare (optimize safety) (type integer x)) + (locally + (declare (type (real 1) x)) + (setq x z)) + (list x z)) +(assert (raises-error? (bug231b nil 1) type-error)) +(assert (raises-error? (bug231b 0 1.5) type-error)) +(assert (raises-error? (bug231b 0 0) type-error)) + (sb-ext:quit :unix-status 104) ; success