0.7.8.10:
[sbcl.git] / tests / compiler.pure.lisp
index 9eac7fb..ba58524 100644 (file)
 ;;; bug caught and fixed by Raymond Toy cmucl-imp 2002-07-10: &REST
 ;;; variable is not optional.
 (assert (null (ignore-errors (eval '(funcall (lambda (&rest) 12))))))
+
+;;; on the PPC, we got the magic numbers in undefined_tramp wrong for
+;;; a while; fixed by CSR 2002-07-18
+(multiple-value-bind (value error)
+    (ignore-errors (some-undefined-function))
+  (assert (null value))
+  (assert (eq (cell-error-name error) 'some-undefined-function)))
+
+;;; Non-symbols shouldn't be allowed as VARs in lambda lists. (Where VAR
+;;; is a variable name, as in section 3.4.1 of the ANSI spec.)
+(assert (null (ignore-errors (eval '(lambda ("foo") 12)))))
+(assert (ignore-errors (eval '(lambda (foo) 12))))
+(assert (null (ignore-errors (eval '(lambda (&optional 12) "foo")))))
+(assert (ignore-errors (eval '(lambda (&optional twelve) "foo"))))
+(assert (null (ignore-errors (eval '(lambda (&optional (12 12)) "foo")))))
+(assert (ignore-errors (eval '(lambda (&optional (twelve 12)) "foo"))))
+(assert (null (ignore-errors (eval '(lambda (&key #\c) "foo")))))
+(assert (ignore-errors (eval '(lambda (&key c) "foo"))))
+(assert (null (ignore-errors (eval '(lambda (&key (#\c #\c)) "foo")))))
+(assert (ignore-errors (eval '(lambda (&key (c #\c)) "foo"))))
+(assert (null (ignore-errors (eval '(lambda (&key ((#\c #\c) #\c)) "foo")))))
+(assert (ignore-errors (eval '(lambda (&key ((:c cbyanyothername) #\c)) "foo"))))
+
+;;; As reported and fixed by Antonio Martinez-Shotton sbcl-devel
+;;; 2002-09-12, this failed in sbcl-0.7.7.23. (with failed AVER
+;;; "(LEAF-HAS-SOURCE-NAME-P LEAF)")
+(assert (= (funcall (eval `(lambda (x) (funcall ,(lambda (y) (+ y 3)) x))) 14)
+          17))
+
+;;; bug 181: bad type specifier dropped compiler into debugger
+(assert (list (compile nil '(lambda (x)
+                             (declare (type (0) x))
+                             x))))
+
+(let ((f (compile nil '(lambda (x)
+                        (make-array 1 :element-type '(0))))))
+  (assert (null (ignore-errors (funcall f)))))
+
+;;; the following functions must not be flushable
+(dolist (form '((make-sequence 'fixnum 10)
+                (concatenate 'fixnum nil)
+                (map 'fixnum #'identity nil)
+                (merge 'fixnum nil nil #'<)))
+  (assert (not (eval `(locally (declare (optimize (safety 0)))
+                        (ignore-errors (progn ,form t)))))))
+
+(dolist (form '((values-list (car (list '(1 . 2))))
+                (fboundp '(set bet))
+                (atan #c(1 1) (car (list #c(2 2))))
+                (nthcdr (car (list (floor (cos 3)))) '(1 2 3 4 5))
+                (nthcdr (car (list 5)) '(1 2 . 3))))
+  (assert (not (eval `(locally (declare (optimize (safety 3)))
+                        (ignore-errors (progn ,form t)))))))
+
+;;; a bug in the MAP deftransform caused non-VECTOR array specifiers
+;;; to cause errors in the compiler.  Fixed by CSR in 0.7.8.10
+(assert (list (compile nil '(lambda (x) (map 'simple-array 'identity x)))))