types of constant default values of keyword arguments not derived?

Bug #309131 reported by Nikodemus Siivola on 2008-12-17
2
Affects Status Importance Assigned to Milestone
SBCL
Medium
Unassigned

Bug Description

  (defun foo (&key (a :x))
    (declare (fixnum a))
    a)

does not cause a warning. (BTW: old SBCL issued a warning, but for a
function, which was never called!)

Changed in sbcl:
importance: Undecided → Medium
status: New → Confirmed
description: updated
Tobias C. Rittweiler (tcr) wrote :

Fixing this bug will not cope well with DEFSTRUCT.

(defstruct foo (x (sb-int:missing-arg) :type fixnum))

will emit a warning because MAKE-FOO will be defined as follows

  (DEFUN MAKE-FOO (&KEY ((:X #:DUM971) (SB-INT:MISSING-ARG)))
    (DECLARE (TYPE FIXNUM #:DUM971))
    (SB-KERNEL::%MAKE-STRUCTURE-INSTANCE-MACRO
     #<SB-KERNEL:DEFSTRUCT-DESCRIPTION FOOBAR> '((:SLOT T . 1)) #:DUM971))

That kind of initialization-value checking is a useful violation of what CLHS specifies
about DEFSTRUCT. I recall some comment or something which mentions this
issue explicitly, perhaps by WHN, but I can't find it right now.

Tobias C. Rittweiler (tcr) wrote :

The last remark was bogus as SB-INT:MISSING-ARG is declared to have return-type NIL
which, of course, is a subtype of every other type.

Must be something wrong on how I tried to fix this bug.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers