Incorrect type error in compiled code involving a CONS type

Bug #1795967 reported by Paul F. Dietz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Low
Unassigned

Bug Description

(defun f316 ()
  (let* ((c1 (list 'x))
         (param (cons c1 0))
         (form
          `(lambda (p1)
             (the
              (cons
               (and
                (or (member a 3 ,c1) keyword)
                (or cons number (eql t)))
               number)
              p1))))
    (funcall (compile nil form) param)))

(f316) ==>

The value
  (#1=(X) . 0)
is not of type
  (CONS
   (OR (MEMBER #1#) (INTEGER 3 3)
       (AND (MEMBER T) (SATISFIES KEYWORDP)))
   NUMBER)
   [Condition of type TYPE-ERROR]

(but, of course, it is.)

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

Cause by

(typep (cons :y 10) '(not (cons (or (member :y) number (and (eql :x) keyword)) number)))
=> T.

because that type is negated into T.

tags: added: types
Changed in sbcl:
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Paul F. Dietz (paul-f-dietz) wrote :

Another example:

(defun f370a (x)
  (declare (type (cons
                  (or null
                      bit
                      (and (eql :a)
                           (satisfies keywordp))
                      )
                  cons)
                 x))
  x)

(print (f370a '(1 nil)))

==>

The value
  (1 NIL)
is not of type
  (CONS (OR NULL BIT (AND (MEMBER :A) (SATISFIES KEYWORDP)))
        CONS)

Revision history for this message
Paul F. Dietz (paul-f-dietz) wrote :

Another example:

(defun f387 (p1)
   (the (cons (or (and keyword (member :b)) (member "a" 1))
              list)
        p1))

(f387 '(:b)) ==>

The value
  (:B)
is not of type
  (CONS
   (OR (AND (SATISFIES KEYWORDP) (MEMBER :B)) (MEMBER "a")
       (INTEGER 1 1))
   LIST)

Revision history for this message
Paul F. Dietz (paul-f-dietz) wrote :

These all appear to be working now. However, there are still type failures from rtp testing. I will open a separate ticket.

Revision history for this message
Christophe Rhodes (csr21-cantab) wrote :

The test cases do all seem to be working. Frustratingly, I can't see an obvious commit to ascribe the workingness to in the range between August 2019 and February 2020, but certainly this report can be closed. Thanks

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