X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fcompiler.pure.lisp;h=5f24fbeeab2afa4b2e5c790f9c27ba2ae583dda8;hb=5abf3b4b94c8c2315777e63729293395dc54992c;hp=a9ad0d8c1cf26a8046561d58fb2749c71350a592;hpb=9d2548ce943f75dd3c77bd070270c19c58f6cb7d;p=sbcl.git diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index a9ad0d8..5f24fbe 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -3071,20 +3071,6 @@ (assert (eql x (funcall fun i))) (assert (eql (- x) (funcall fun i)))))))) -(with-test (:name (load-time-value :type-derivation)) - (flet ((test (type form value-cell-p) - (let ((derived (funcall (compile - nil - `(lambda () - (ctu:compiler-derived-type - (load-time-value ,form))))))) - (unless (equal type derived) - (error "wanted ~S, got ~S" type derived))))) - (let ((* 10)) - (test '(integer 11 11) '(+ * 1) nil)) - (let ((* "fooo")) - (test '(integer 4 4) '(length *) t)))) - (with-test (:name :float-division-using-exact-reciprocal) (flet ((test (lambda-form arg res &key (check-insts t)) (let* ((fun (compile nil lambda-form)) @@ -3958,3 +3944,32 @@ (= #C(2d0 3d0) (the (complex double-float) x)))))) (assert (funcall foo #C(2d0 3d0))) (assert (not (funcall foo #C(1d0 2d0)))))) + +(with-test (:name :lvar-externally-checkable-type-nil) + ;; Used to signal a BUG during compilation. + (let ((fun (compile nil `(lambda (a) (parse-integer "12321321" (the (member :start) a) 1))))) + (multiple-value-bind (i p) (funcall fun :start) + (assert (= 2321321 i)) + (assert (= 8 p))) + (multiple-value-bind (i e) (ignore-errors (funcall fun :end)) + (assert (not i)) + (assert (typep e 'type-error))))) + +(with-test (:name :simple-type-error-in-bound-propagation-a) + (compile nil `(lambda (i) + (declare (unsigned-byte i)) + (expt 10 (expt 7 (- 2 i)))))) + +(with-test (:name :simple-type-error-in-bound-propagation-b) + (assert (equal `(FUNCTION (UNSIGNED-BYTE) + (VALUES (SINGLE-FLOAT -1F0 1F0) &OPTIONAL)) + (sb-kernel:%simple-fun-type + (compile nil `(lambda (i) + (declare (unsigned-byte i)) + (cos (expt 10 (+ 4096 i))))))))) + +(with-test (:name :fixed-%more-arg-values) + (let ((fun (compile nil `(lambda (&rest rest) + (declare (optimize (safety 0))) + (apply #'cons rest))))) + (assert (equal '(car . cdr) (funcall fun 'car 'cdr)))))