X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fcompiler-1.impure-cload.lisp;h=1eb8e3d88cd438b533d866c84586986e98537746;hb=bfa4310e41dcd011ca9d139f29be1c5757b41378;hp=6d61de0afc2c16b5dbbceb65a663fbe95b42add6;hpb=00c93ebddb9224ae6d554fa010d3c19ddbf401d9;p=sbcl.git diff --git a/tests/compiler-1.impure-cload.lisp b/tests/compiler-1.impure-cload.lisp index 6d61de0..1eb8e3d 100644 --- a/tests/compiler-1.impure-cload.lisp +++ b/tests/compiler-1.impure-cload.lisp @@ -65,21 +65,25 @@ (0 "GMT" . "GDT") (-2 "MET" . "MET DST")) "*The string representations of the time zones.") +(declaim (optimize (debug 1) (speed 1) (space 1))) + ;;; The old CMU CL Python compiler assumed that it was safe to infer ;;; function types (including return types) from function definitions -;;; and then use them to optimize code later. This is of course bad -;;; when functions are redefined. The problem was fixed in -;;; sbcl-0.6.12.57. +;;; and then use them to optimize code later [and it was almost +;;; right!]. This is of course bad when functions are redefined. The +;;; problem was fixed in sbcl-0.6.12.57. (defun foo (x) - (if (plusp x) - 1.0 - 0)) -(defun bar (x) - (typecase (foo x) - (fixnum :fixnum) - (real :real) - (string :string) - (t :t))) + (if (plusp x) + 1.0 + 0)) +(eval '(locally + (defun bar (x) + (typecase (foo x) + (fixnum :fixnum) + (real :real) + (string :string) + (t :t))) + (compile 'bar))) (assert (eql (bar 11) :real)) (assert (eql (bar -11) :fixnum)) (setf (symbol-function 'foo) #'identity) @@ -103,12 +107,14 @@ ;;; bug 31 turned out to be a manifestation of non-ANSI array type ;;; handling, fixed by CSR in sbcl-0.7.3.8. (defun array-element-type-handling (x) + (declare (optimize safety)) (declare (type (vector cons) x)) (when (consp (aref x 0)) (aref x 0))) -(assert (eq (array-element-type-handling - (make-array 3 :element-type t :initial-element 0)) - nil)) +(assert (raises-error? + (array-element-type-handling + (make-array 3 :element-type t :initial-element 0)) + type-error)) ;;; bug 220: type check inserted after all arguments in MV-CALL caused ;;; failure of stack analysis