types of constant default values of keyword arguments not derived?

Bug #309131 reported by Nikodemus Siivola
2
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
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!)

Tags: compiler-ir1
Changed in sbcl:
importance: Undecided → Medium
status: New → Confirmed
description: updated
Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
Stas Boukarev (stassats) wrote :

33e6b37eaf92e41cbd9b7d951442d145cd653b3b

Changed in sbcl:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.