0.9.2.23: ansi fixes
authorNikodemus Siivola <nikodemus@random-state.net>
Mon, 4 Jul 2005 13:09:20 +0000 (13:09 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Mon, 4 Jul 2005 13:09:20 +0000 (13:09 +0000)
 * fill slots in TYPE-ERRORs from COERCE.
 * classes are type designators and must be accepted by MAKE-CONDITION.
 * MULTIPLE-VALUE-SETQ returns the primary value of the values form.
 * COMPILE must not return NIL.

NEWS
src/code/coerce.lisp
src/code/condition.lisp
src/code/defboot.lisp
src/compiler/target-main.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 68cf096..bc4b411 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ changes in sbcl-0.9.3 relative to sbcl-0.9.2:
   * bug fix: out-of-line SB-SYS:FOREIGN-SYMBOL-ADDRESS did not work
     for variables on SBCL built with linkage-tables. (reported by Luis
     Oliveira)
+  * various error reporting improvements.
   * optimizations: LOGNOR on fixnums is improved in the MIPS backend.
     (Thanks to Thiemo Seufer)
   * threads
@@ -24,6 +25,13 @@ changes in sbcl-0.9.3 relative to sbcl-0.9.2:
        starting up or going down
     ** bug fix: a race where an exiting thread could lose its stack to gc
     ** fixed numerous gc deadlocks introduced in the pthread merge
+  * fixed some bugs revealed by Paul Dietz' test suite:
+    ** TYPE-ERRORs from signalled by COERCE now have DATUM and
+       EXPECTED-TYPE slots filled.
+    ** MULTIPLE-VALUE-SETQ always returns the primary value of the
+       values form.
+    ** MAKE-CONDITION accepts classes as type-designators.
+    ** COMPILE may never return NIL.
 
 changes in sbcl-0.9.2 relative to sbcl-0.9.1:
   * numerous signal handling fixes to increase stability
index 59bd1da..13762a3 100644 (file)
           (/show0 "entering COERCE-ERROR")
           (error 'simple-type-error
                  :format-control "~S can't be converted to type ~S."
-                 :format-arguments (list object output-type-spec))))
+                 :format-arguments (list object output-type-spec)
+                 :datum object
+                 :expected-type output-type-spec)))
     (let ((type (specifier-type output-type-spec)))
       (cond
        ((%typep object output-type-spec)
index b89d6d8..ea93f2a 100644 (file)
 \f
 ;;;; MAKE-CONDITION
 
-(defun make-condition (thing &rest args)
+(defun make-condition (type &rest args)
   #!+sb-doc
   "Make an instance of a condition object using the specified initargs."
   ;; Note: ANSI specifies no exceptional situations in this function.
   ;; signalling simple-type-error would not be wrong.
-  (let* ((thing (or (and (symbolp thing) (find-classoid thing nil))
-                   thing))
-        (class (typecase thing
-                 (condition-classoid thing)
+  (let* ((type (or (and (symbolp type) (find-classoid type nil))
+                   type))
+        (class (typecase type
+                 (condition-classoid type)
+                 (class
+                  ;; Punt to CLOS.
+                  (return-from make-condition (apply #'make-instance type args)))
                  (classoid
                   (error 'simple-type-error
-                         :datum thing
+                         :datum type
                          :expected-type 'condition-class
                          :format-control "~S is not a condition class."
-                         :format-arguments (list thing)))
+                         :format-arguments (list type)))
                  (t
                   (error 'simple-type-error
-                         :datum thing
+                         :datum type
                          :expected-type 'condition-class
-                         :format-control "bad thing for class argument:~%  ~S"
-                         :format-arguments (list thing)))))
+                         :format-control "Bad type argument:~%  ~S"
+                         :format-arguments (list type)))))
         (res (make-condition-object args)))
     (setf (%instance-layout res) (classoid-layout class))
     ;; Set any class slots with initargs present in this call.
index c505819..43ad076 100644 (file)
 (defmacro-mundanely multiple-value-setq (vars value-form)
   (unless (list-of-symbols-p vars)
     (error "Vars is not a list of symbols: ~S" vars))
-  `(values (setf (values ,@vars) ,value-form)))
+  ;; MULTIPLE-VALUE-SETQ is required to always return just the primary
+  ;; value of the value-from, even if there are no vars. (SETF VALUES)
+  ;; in turn is required to return as many values as there are
+  ;; value-places, hence this:
+  (if vars
+      `(values (setf (values ,@vars) ,value-form))
+      `(values ,value-form)))
 
 (defmacro-mundanely multiple-value-list (value-form)
   `(multiple-value-call #'list ,value-form))
index 5d81a45..a02797b 100644 (file)
   otherwise THING is NAME. When NAME is not NIL, the compiled function
   is also set into (MACRO-FUNCTION NAME) if NAME names a macro, or into
   (FDEFINITION NAME) otherwise."
-  (compile-in-lexenv name definition (make-null-lexenv)))
+  (multiple-value-bind (function warnings-p failure-p) 
+      (compile-in-lexenv name definition (make-null-lexenv))
+    (values (or function
+               name
+               (lambda (&rest arguments)
+                 (error 'simple-program-error
+                        :format-control 
+                        "Called function compiled with errors. Original ~
+                          definition:~%  ~S~@[~%Arguments:~% ~{ ~S~}~]"
+                        :format-arguments (list definition arguments))))
+           warnings-p
+           failure-p)))
index 8a2ed6d..cb1893a 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.9.2.22"
+"0.9.2.23"