Incorrect type error in code involving REPLACE

Bug #2050049 reported by Paul F. Dietz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Confirmed
Undecided
Unassigned

Bug Description

(defun bug312 ()
  (let* ((params
           (list (coerce '(1 2 3 4) 'simple-vector)
                 (list #c(-1.0d0 7.0d0))))
         (lam
           `(lambda (p1 p2)
              (declare (type
                        (and
                         cons
                         (or
                          (eql ,(cadr params))
                          (eql (#c(3.0d0 5.0d0) 1/2))))
                        p2))
              (replace p1
                       (the (cons (eql ,(caadr params)) t) p2)))))
    (apply (compile nil lam) params)))

(bug312) ==>

The value
  (#C(3.0d0 5.0d0) 1/2)
is not of type
  (CONS (MEMBER #C(-1.0d0 7.0d0)) T)
   [Condition of type TYPE-ERROR]

This may be a bug in type simplification. Weirdly, the bug goes away if the complex numbers are #C(1.0 2.0d0) and #C(3.0d0 4.0d0).

x86-64, "2.4.0.223-aaed94aaf"

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

(type-union (specifier-type '(cons (complex (double-float 3.0d0 5.0d0))))
            (specifier-type '(cons (complex (double-float -1.0d0 7.0d0)) null)))

produces some nonsense:

#<UNION-TYPE (OR (CONS (COMPLEX (DOUBLE-FLOAT 3.0d0 5.0d0)) T)
                 (CONS (OR (COMPLEX (DOUBLE-FLOAT -1.0d0 (3.0d0))) (COMPLEX (DOUBLE-FLOAT (5.0d0) 7.0d0))) NULL))>

Stas Boukarev (stassats)
Changed in sbcl:
status: New → Confirmed
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.