Changeset 244


Ignore:
Timestamp:
Jan 9, 2004, 1:26:59 PM (21 years ago)
Author:
Gary Byers
Message:

BAD-SLOT-TYPE, IMPROPER-LIST conditions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/l1-error-system.lisp

    r6 r244  
    9090                     (type-error-datum c)
    9191                     (type-error-expected-type c)))))
     92
     93(define-condition bad-slot-type (type-error)
     94  ((slot-definition :initform nil :initarg :slot-definition)
     95   (instance :initform nil :initarg :instance))
     96  (:report (lambda (c s)
     97             (format s "The value ~s can not be used to set the value of the slot ~s in ~s, because it is not of type ~s. "
     98                     (type-error-datum c)
     99                     (slot-definition-name (slot-value c 'slot-definition))
     100                     (slot-value c 'instance)
     101                     (type-error-expected-type c)))))
     102
     103(define-condition bad-slot-type-from-initform (bad-slot-type)
     104  ()
     105  (:report (lambda (c s)
     106             (let* ((slotd (slot-value c 'slot-definition)))
     107               (format s "The value ~s, derived from the initform ~s, can not be used to set the value of the slot ~s in ~s, because it is not of type ~s. "
     108                     (type-error-datum c)
     109                     (slot-definition-initform slotd)
     110                     (slot-definition-name slotd)
     111                     (slot-value c 'instance)
     112                     (type-error-expected-type c))))))
     113
     114(define-condition bad-slot-type-from-initarg (bad-slot-type)
     115  ((initarg-name :initarg :initarg-name))
     116  (:report (lambda (c s)
     117             (let* ((slotd (slot-value c 'slot-definition)))
     118               (format s "The value ~s, derived from the initarg ~s, can not be used to set the value of the slot ~s in ~s, because it is not of type ~s. "
     119                     (type-error-datum c)
     120                     (slot-value c 'initarg-name)
     121                     (slot-definition-name slotd)
     122                     (slot-value c 'instance)
     123                     (type-error-expected-type c))))))
     124 
     125
     126(define-condition improper-list (type-error)
     127  ((expected-type :initform '(satisfies proper-list-p) :reader type-error-expected-type)))
     128
     129
     130
    92131
    93132(let* ((magic-token '("Unbound")))
     
    845884        (cons $xnotfun 'call-special-operator-or-macro)
    846885        (cons $xaccessnth 'sequence-index-type-error)
     886        (cons $ximproperlist 'improper-list)
    847887        ))
    848888
Note: See TracChangeset for help on using the changeset viewer.