Ticket #872 (closed defect: fixed)
non-standard type of warning for shadowed clauses in typecase
| Reported by: | agrostis | Owned by: | gb |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | ANSI CL Compliance | Version: | trunk |
| Keywords: | Cc: | cl-json-devel@… |
Description
The definition of TYPECASE, ETYPECASE and CTYPECASE in the standard (CLHS §5.3) allows that there be multiple clauses specifying a matching type. If a clause is completely shadowed by earlier clauses, the compiler may issue a warning. The type of the warning is explicitly mentioned to be STYLE-WARNING. The exact wording is as follows:
The compiler may choose to issue a warning of type style-warning if a clause will never be selected because it is completely shadowed by earlier clauses.
However, CCL issues a SIMPLE-WARNING in such situations, e. g.:
(block nil
(handler-bind ((warning (lambda (w) (return (type-of w)))))
(macroexpand '(typecase nr
(long-float #\L)
(double-float #\D)
(short-float #\S)
(t #\E)))))
⇒ SIMPLE-WARNING
Which, I believe, contradicts the above disposition of the standard. One consequence is that, with ASDF, such a warning issued during the compilation of a file makes COMPILE-OP fail, signalling an error where, in fact, there should be none.
