X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fcompiler.impure.lisp;h=33f0a4df971f3a0a9527d9ed451daaec9370b710;hb=4372fa18426aa89379563bcbf61941317c93fce0;hp=d9ea3fbe3e5e2c48b90631b343220785775a6584;hpb=3c76429562383ac91cec4880b7b86234362e1ed4;p=sbcl.git diff --git a/tests/compiler.impure.lisp b/tests/compiler.impure.lisp index d9ea3fb..33f0a4d 100644 --- a/tests/compiler.impure.lisp +++ b/tests/compiler.impure.lisp @@ -420,6 +420,102 @@ BUG 48c, not yet fixed: (ignore-errors (bug110 0)) (declare (ignore result)) (assert (typep condition 'type-error))) + +;;; bug 202: the compiler failed to compile a function, which derived +;;; type contradicted declared. +(declaim (ftype (function () null) bug202)) +(defun bug202 () + t) + +;;; bugs 178, 199: compiler failed to compile a call of a function +;;; with a hairy type +(defun bug178 (x) + (funcall (the function (the standard-object x)))) + +(defun bug199-aux (f) + (eq nil (funcall f))) + +(defun bug199 (f x) + (declare (type (and function (satisfies bug199-aux)) f)) + (funcall f x)) + +;;; check non-toplevel DEFMACRO +(defvar *defmacro-test-status* nil) + +(defun defmacro-test () + (fmakunbound 'defmacro-test-aux) + (let* ((src "defmacro-test.lisp") + (obj (compile-file-pathname src))) + (unwind-protect + (progn + (compile-file src) + (assert (equal *defmacro-test-status* '(function a))) + (setq *defmacro-test-status* nil) + (load obj) + (assert (equal *defmacro-test-status* nil)) + (macroexpand '(defmacro-test-aux 'a)) + (assert (equal *defmacro-test-status* '(macro 'a z-value))) + (eval '(defmacro-test-aux 'a)) + (assert (equal *defmacro-test-status* '(expanded 'a z-value)))) + (ignore-errors (delete-file obj))))) + +(defmacro-test) + +;;; bug 204: EVAL-WHEN inside a local environment +(defvar *bug204-test-status*) + +(defun bug204-test () + (let* ((src "bug204-test.lisp") + (obj (compile-file-pathname src))) + (unwind-protect + (progn + (setq *bug204-test-status* nil) + (compile-file src) + (assert (equal *bug204-test-status* '((:expanded :load-toplevel) + (:called :compile-toplevel) + (:expanded :compile-toplevel)))) + (setq *bug204-test-status* nil) + (load obj) + (assert (equal *bug204-test-status* '((:called :load-toplevel))))) + (ignore-errors (delete-file obj))))) + +(bug204-test) + +;;; toplevel SYMBOL-MACROLET +(defvar *symbol-macrolet-test-status*) + +(defun symbol-macrolet-test () + (let* ((src "symbol-macrolet-test.lisp") + (obj (compile-file-pathname src))) + (unwind-protect + (progn + (setq *symbol-macrolet-test-status* nil) + (compile-file src) + (assert (equal *symbol-macrolet-test-status* + '(2 1))) + (setq *symbol-macrolet-test-status* nil) + (load obj) + (assert (equal *symbol-macrolet-test-status* '(2)))) + (ignore-errors (delete-file obj))))) + +(symbol-macrolet-test) + +;;; On the x86, this code failed to compile until sbcl-0.7.8.37: +(defun x86-assembler-failure (x) + (declare (optimize (speed 3) (safety 0))) + (eq (setf (car x) 'a) nil)) + +;;; bug 211: :ALLOW-OTHER-KEYS +(defun bug211d (&key (x :x x-p) ((:allow-other-keys y) :y y-p)) + (list x x-p y y-p)) + +(assert (equal (bug211d) '(:x nil :y nil))) +(assert (equal (bug211d :x 1) '(1 t :y nil))) +(assert (raises-error? (bug211d :y 2) program-error)) +(assert (equal (bug211d :y 2 :allow-other-keys t :allow-other-keys nil) + '(:x nil t t))) +(assert (raises-error? (bug211d :y 2 :allow-other-keys nil) program-error)) + ;;;; tests not in the problem domain, but of the consistency of the ;;;; compiler machinery itself