describe: show the same information about functions for 'x and #'x.
[sbcl.git] / tests / compiler.test.sh
index 57a37a4..f2921ef 100644 (file)
@@ -26,6 +26,14 @@ cat > $tmpfilename <<EOF
 EOF
 expect_failed_compile $tmpfilename
 
+# This should fail, as type inference should show that the call to FOO
+# has a wrong number of args.
+cat > $tmpfilename <<EOF
+    (in-package :cl-user)
+    (defun foo (x) (or x (foo x x)))
+EOF
+expect_failed_compile $tmpfilename
+
 # This should fail, as we define a function multiply in the same file
 # (CLHS 3.2.2.3).
 cat > $tmpfilename <<EOF
@@ -156,7 +164,7 @@ cat > $tmpfilename <<EOF
     (defun foo (x)
       (error x))
 EOF
-fail_on_compiler_note $tmpfilename
+fail_on_condition_during_compile sb-ext:compiler-note $tmpfilename
 
 # test case from Rudi for some CLOS WARNINGness that shouldn't have
 # been there
@@ -213,7 +221,7 @@ cat > $tmpfilename <<EOF
       (declare (muffle-conditions code-deletion-note))
       (if t (foo) (foo)))
 EOF
-fail_on_compiler_note $tmpfilename
+fail_on_condition_during_compile sb-ext:compiler-note $tmpfilename
 
 cat > $tmpfilename <<EOF
     (defun foo (x y)
@@ -221,7 +229,7 @@ cat > $tmpfilename <<EOF
       (declare (optimize speed))
       (+ x y))
 EOF
-fail_on_compiler_note $tmpfilename
+fail_on_condition_during_compile sb-ext:compiler-note $tmpfilename
 
 cat > $tmpfilename <<EOF
     (declaim (muffle-conditions compiler-note))
@@ -229,7 +237,7 @@ cat > $tmpfilename <<EOF
       (declare (optimize speed))
       (+ x y))
 EOF
-fail_on_compiler_note $tmpfilename
+fail_on_condition_during_compile sb-ext:compiler-note $tmpfilename
 
 cat > $tmpfilename <<EOF
     (declaim (muffle-conditions compiler-note))
@@ -238,7 +246,7 @@ cat > $tmpfilename <<EOF
       (declare (optimize speed))
       (+ x y))
 EOF
-expect_compiler_note $tmpfilename
+expect_condition_during_compile sb-ext:compiler-note $tmpfilename
 
 # undefined variable causes a WARNING
 cat > $tmpfilename <<EOF
@@ -441,5 +449,69 @@ cat > $tmpfilename <<EOF
 EOF
 expect_clean_cload $tmpfilename
 
+cat > $tmpfilename <<EOF
+(in-package :cl-user)
+(defmacro foo () (error "ERROR at macroexpansion time."))
+(defun bar () (foo))
+EOF
+expect_condition_during_compile sb-c:compiler-error $tmpfilename
+
+cat > $tmpfilename <<EOF
+(eval-when (:compile-toplevel)
+  (error "ERROR within EVAL-WHEN."))
+EOF
+expect_condition_during_compile simple-error $tmpfilename
+
+cat > $tmpfilename <<EOF
+(defun slot-name-incf (s)
+  (with-slots (no-such-slot) s
+    (incf no-such-slot)))
+EOF
+expect_clean_cload $tmpfilename
+
+cat > $tmpfilename <<EOF
+(in-package :cl-user)
+
+(defun foo ()
+  (declare (muffle-conditions warning))
+  (let ((em 0d0))
+    (declare (type double-float em))
+    (dotimes (i 42)
+      (setf em (float (1+ i))))))
+EOF
+expect_clean_compile $tmpfilename
+
+cat > $tmpfilename <<EOF
+(in-package :cl-user)
+
+(defun foo ()
+  (declare (muffle-conditions warning))
+  (flet ((foo ()
+           (declare (values fixnum))
+           nil))
+    (foo)))
+EOF
+expect_clean_compile $tmpfilename
+
+cat > $tmpfilename <<EOF
+(in-package :cl-user)
+
+(defun foo (x)
+  (declare (muffle-conditions warning)
+           (type (vector (mod 7) 1) x))
+  (setf (aref x 0) 8)
+  x)
+EOF
+expect_clean_compile $tmpfilename
+
+cat > $tmpfilename <<EOF
+(in-package :cl-user)
+
+(declaim (notinline foo))
+(let ((i 0)) (defun foo (x) (incf i x)))
+(defun bar (x) (foo x))
+EOF
+fail_on_condition_during_compile sb-ext:compiler-note $tmpfilename
+
 # success
 exit $EXIT_TEST_WIN