Changeset 7234


Ignore:
Timestamp:
Sep 17, 2007, 7:40:29 AM (12 years ago)
Author:
gb
Message:

%REQUIRE-TYPE tries to map back to the type from the predicate in the case
when an error is signaled.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0709/ccl/level-1/sysutils.lisp

    r2326 r7234  
    310310    (%kernel-restart $xwrongtype arg type)))
    311311
    312 ; Might want to use an inverted mapping instead of (satisfies ccl::obscurely-named)
     312;;; Might want to use an inverted mapping instead of (satisfies ccl::obscurely-named)
    313313(defun %require-type (arg predsym)
    314     (if (funcall predsym arg)
     314  (if (funcall predsym arg)
    315315    arg
    316     (%kernel-restart $xwrongtype arg `(satisfies ,predsym))))
     316    (%kernel-restart $xwrongtype arg (type-for-predicate predsym))))
    317317
    318318(defun %require-type-builtin (arg type-cell) 
     
    323323
    324324
     325;;; In lieu of an inverted mapping, at least try to find cases involving
     326;;; builtin numeric types and predicates associated with them.
     327(defun type-for-predicate (pred)
     328  (or (block find
     329        (maphash #'(lambda (type ctype) (when (and (typep ctype 'numeric-ctype)
     330                                                   (eq (numeric-ctype-predicate ctype)
     331                                                       pred))
     332                                          (return-from find type)))
     333                 *builtin-type-info*))
     334      `(satisfies ,pred)))
    325335
    326336
Note: See TracChangeset for help on using the changeset viewer.