Better error message for SLEEP.
authorStas Boukarev <stassats@gmail.com>
Tue, 18 Dec 2012 17:38:24 +0000 (21:38 +0400)
committerStas Boukarev <stassats@gmail.com>
Tue, 18 Dec 2012 17:38:24 +0000 (21:38 +0400)
Add explicit-check to defknown, sleep already explicitly checks the
argument.
Slightly improve the produced error message.

src/code/toplevel.lisp
src/compiler/fndb.lisp

index a72e064..f5a7aa9 100644 (file)
@@ -198,7 +198,8 @@ any non-negative real number."
   (when (or (not (realp seconds))
             (minusp seconds))
     (error 'simple-type-error
-           :format-control "invalid argument to SLEEP: ~S"
+           :format-control "Invalid argument to SLEEP: -1, ~
+                            should be a non-negative real."
            :format-arguments (list seconds)
            :datum seconds
            :expected-type '(real 0)))
index a83a568..ac1482d 100644 (file)
 (defknown (get-internal-run-time get-internal-real-time)
   () internal-time (flushable))
 
-(defknown sleep ((or (rational 0) (float 0.0))) null)
+(defknown sleep ((real 0)) null (explicit-check))
 
 ;;; Even though ANSI defines LISP-IMPLEMENTATION-TYPE and
 ;;; LISP-IMPLEMENTATION-VERSION to possibly punt and return NIL, we