loop destructuring with type error

Bug #1322923 reported by `bg`
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Medium
Unassigned

Bug Description

A loop example from CLHS: http://www.lispworks.com/documentation/lw51/CLHS/Body/06_aag.htm

;; If all the types are the same, this way is even simpler.
(loop for (a b c) of-type float in
       '((1.0 2.0 4.0) (5.0 6.0 8.3) (8.0 9.0 10.4))
       collect (list c b a))

Expected to return: ((4.0 2.0 1.0) (8.3 6.0 5.0) (10.4 9.0 8.0))
But instead SBCL signals a SIMPLE-TYPE-ERROR:

Value of NIL in
  (LET ((A 0.0)
        (B 0.0)
        (C 0.0)
        (#1=#:LOOP-IGNORE-1107 NIL)
        (#2=#:LOOP-LIST-1106
         '((1.0 2.0 4.0) (5.0 6.0 8.3) (8.0 9.0 10.4))))
    (DECLARE (TYPE LIST #2#)
             (TYPE FLOAT #1#)
             (IGNORE #1#)
             (TYPE FLOAT C)
             (TYPE FLOAT B)
             (TYPE FLOAT A))
    (SB-LOOP::WITH-LOOP-LIST-COLLECTION-HEAD #3=(#4=#:LOOP-LIST-HEAD-1108
                                                 #:LOOP-LIST-TAIL-1109)
      (SB-LOOP::LOOP-BODY NIL
                          (NIL
                           (SB-LOOP::LOOP-REALLY-DESETQ
                            #5=(A B C) #6=(CAR #2#))
                           NIL
                           (SB-LOOP::LOOP-REALLY-DESETQ #2#
                                                        #7=(CDR
                                                            #2#)))
                          ((SB-LOOP::LOOP-COLLECT-RPLACD #3#
                                                         (LIST
                                                          (LIST
                                                           C B
                                                           A))))
                          ((WHEN (ENDP #2#)
                             (GO SB-LOOP::END-LOOP))
                           (SB-LOOP::LOOP-REALLY-DESETQ #5# #6#)
                           NIL
                           (SB-LOOP::LOOP-REALLY-DESETQ #2#
                                                        #7#))
                          ((RETURN-FROM NIL
                             (SB-LOOP::LOOP-COLLECT-ANSWER
                              #4#))))))

is
  NIL,
not a
  FLOAT.
   [Condition of type SIMPLE-TYPE-ERROR]

sbcl --version
SBCL 1.1.18

Linux hostname 3.12.13-gentoo #1 SMP PREEMPT Sun Mar 9 17:59:44 MDT 2014 x86_64 Intel(R) Core(TM)2 CPU T7600 @ 2.33GHz GenuineIntel GNU/Linux

Tags: loop
Nic M (nicdevel)
tags: added: loo
tags: added: loop
removed: loo
Stas Boukarev (stassats)
Changed in sbcl:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Stas Boukarev (stassats) wrote :

In a5ac94abb11975f334d3eb18f6f339b9e7dc5a5d.

Changed in sbcl:
status: Triaged → Fix Committed
Changed in sbcl:
status: Fix Committed → 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.