Loop destructuring default values and declarations
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Low
|
Unassigned |
Bug Description
By Eric Marsden on sbcl-devel@
CLtS 6.1.2.2 says that "If the optional type-spec argument is supplied
for the variable var, but there is no related expression to be
evaluated, var is initialized to an appropriate default value for its
type. For example, for the types t, number, and float, the default
values are nil, 0, and 0.0 respectively.".
It seems to me that in the example below (from the spec BTW, even if
examples are not normative), the compiler is raising a spurious error
concerning a LOOP-IGNORE-XX variable.
* (lisp-implement
"1.1.8.
* (loop with (a b c) of-type float return (format nil "~A ~A ~A" a b c))
; in: LOOP WITH
; (LET ((A 0.0) (B 0.0) (C 0.0) (#:LOOP-IGNORE-609 NIL))
; (DECLARE (TYPE FLOAT #:LOOP-IGNORE-609)
; (IGNORE #:LOOP-IGNORE-609)
; (TYPE FLOAT C)
; (TYPE FLOAT B)
; (TYPE FLOAT A))
; (SB-LOOP::LOOP-BODY NIL NIL
; ((RETURN-FROM NIL (FORMAT NIL "~A ~A ~A" A B C))) NIL
; NIL))
;
; caught WARNING:
; Constant NIL conflicts with its asserted type FLOAT.
(From sacla-tests)
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
Got fixed in a5ac94abb11975f 334d3eb18f6f339 b9e7dc5a5d.