X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=inline;f=tests%2Fcompiler.pure.lisp;h=5435c431a8819e2009979bd153ada346550a31f7;hb=0a15b6bbf9d5d3a64b5ac08bb96b6e5ec221d2ae;hp=ff5d41b99112496e79475dabe3150532834f9599;hpb=829d76d5f12e1c1b6b21ca4c71b34719b8fed5e1;p=sbcl.git diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index ff5d41b..5435c43 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -2676,6 +2676,14 @@ (assert (eq 'list type)) (assert derivedp))) +(with-test (:name :rest-list-type-derivation2) + (multiple-value-bind (type derivedp) + (funcall (funcall (compile nil `(lambda () + (lambda (&rest args) + (ctu:compiler-derived-type args)))))) + (assert (eq 'list type)) + (assert derivedp))) + (with-test (:name :base-char-typep-elimination) (assert (eq (funcall (lambda (ch) (declare (type base-char ch) (optimize (speed 3) (safety 0))) @@ -3531,3 +3539,54 @@ (* b (z b c)))) (loop for i below 10 do (setf a (z a a))))))) + +(with-test (:name :bug-309130) + (assert (eq :warning + (handler-case + (compile nil `(lambda () (svref (make-array 8 :adjustable t) 1))) + ((and warning (not style-warning)) () + :warning)))) + (assert (eq :warning + (handler-case + (compile nil `(lambda (x) + (declare (optimize (debug 0))) + (declare (type vector x)) + (list (fill-pointer x) (svref x 1)))) + ((and warning (not style-warning)) () + :warning)))) + (assert (eq :warning + (handler-case + (compile nil `(lambda (x) + (list (vector-push (svref x 0) x)))) + ((and warning (not style-warning)) () + :warning)))) + (assert (eq :warning + (handler-case + (compile nil `(lambda (x) + (list (vector-push-extend (svref x 0) x)))) + ((and warning (not style-warning)) () + :warning))))) + +(with-test (:name :bug-646796) + (assert 42 + (funcall + (compile nil + `(lambda () + (load-time-value (the (values fixnum) 42))))))) + +(with-test (:name :bug-654289) + (let* ((big (labels ((make-tree (n acc) + (cond ((zerop n) acc) + (t (make-tree (1- n) (cons acc acc)))))) + (make-tree 10000 nil))) + (small '((1) (2) (3))) + (t0 (get-internal-run-time)) + (f1 (compile nil `(lambda (x) (eq x (quote ,big))))) + (t1 (get-internal-run-time)) + (f2 (compile nil `(lambda (x) (eq x (quote ,small))))) + (t2 (get-internal-run-time))) + (assert (funcall f1 big)) + (assert (funcall f2 small)) + ;; Compile time should not explode just because there's a big constant + ;; object in the source. + (assert (> 10 (abs (- (- t1 t0) (- t2 t1)))))))