Inconsistent style-warning for addition of null-adjacent values
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Invalid
|
Undecided
|
Unassigned |
Bug Description
In trying to reproduce a bug (backstory in comment below) I came across this bug which yields inconsistent behavior when typechecking.
CL-USER> (defun blarg1 (value)
(+ 2 (car value)))
BLARG1
CL-USER> (defun blarg2 (value)
(+ 2 (when value
; in: DEFUN BLARG2
; (WHEN VALUE (CAR VALUE))
; ==>
; NIL
;
; caught STYLE-WARNING:
; This is not a NUMBER:
; NIL
; See also:
; The SBCL Manual, Node "Handling of Types"
;
; compilation unit finished
; caught 1 STYLE-WARNING condition
BLARG2
The functions compile and execute correctly:
(blarg1 (list 5)) and (blarg2 (list 5)) both return 7.
(blarg1 nil) and (blarg2 nil) return a type-error.
The assembly emitted for these functions differs.
Reproduced on SBCL 2.3.3, SBCL 2.4.3 and SBCL 2.4.4.46-c6713be25
uname -a
Linux ppoitras-
Reproduced with *features*
(:CLPM-CLIENT :ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX
:NON-BASE-
:ANSI-CL :COMMON-LISP :ELF :IEEE-FLOATING-
:PACKAGE-
:SBCL :UNIX)
and also
(:SWANK ...same features as above...)
== Note ==
This is not actively causing us issues. I'd rank it as low-priority, but I reported it anyway in the event it's a useful case to figure out weird behavior in the type checking.
description: | updated |
== Unimportant context ==
The context for this bug was that
(defun blarg0 (plist) ing-bind (&key a b c)
(destructur
plist
(+ a b c))
used to return a style-warning under 2.3.3 and now no longer does. This difference of behavior caused me to investigate, but the cause of this particular difference in behavior is that the destructuring-bind macro now uses getf rather than sb-c::ds-getf. The latter has a structure that ressembles blarg2, and which throws the style-warning.