AND type checks for subtypeness

Bug #1610989 reported by Thomas Bartscher
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Undecided
Unassigned

Bug Description

A type check like this
> (typep x '(and vector (not string)))
fails with the error
#<NEGATION-TYPE (NOT (VECTOR STRING))> is not a subtype of VECTOR

While that is certainly true, this seems overzealous – the intersection of these types isn't empty and the type declaration should be absolutely valid. The assumption that in an intersection type one type needs to be a subtype of the other is false.

This has been done on Linux thomas 4.6.0-1-amd64 #1 SMP Debian 4.6.4-1 (2016-07-18) x86_64 GNU/Linux with SBCL 1.3.7.61-5fc41bd.

* *features*
(:HTML-TEMPLATE :CL-FAD :BORDEAUX-THREADS ALEXANDRIA.0.DEV::SEQUENCE-EMPTYP
 :THREAD-SUPPORT :QUICKLISP :SB-BSD-SOCKETS-ADDRINFO :ASDF-PACKAGE-SYSTEM
 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE
 :64-BIT :64-BIT-REGISTERS :ALIEN-CALLBACKS :ANSI-CL :ASH-RIGHT-VOPS
 :C-STACK-IS-CONTROL-STACK :COMMON-LISP :COMPARE-AND-SWAP-VOPS
 :COMPLEX-FLOAT-VOPS :CYCLE-COUNTER :ELF :FLOAT-EQL-VOPS
 :FP-AND-PC-STANDARD-SAVE :GENCGC :IEEE-FLOATING-POINT :INLINE-CONSTANTS
 :INTEGER-EQL-VOP :LARGEFILE :LINKAGE-TABLE :LINUX :LITTLE-ENDIAN
 :MEMORY-BARRIER-VOPS :MULTIPLY-HIGH-VOPS :OS-PROVIDES-BLKSIZE-T
 :OS-PROVIDES-DLADDR :OS-PROVIDES-DLOPEN :OS-PROVIDES-GETPROTOBY-R
 :OS-PROVIDES-POLL :OS-PROVIDES-PUTWC :OS-PROVIDES-SUSECONDS-T
 :PACKAGE-LOCAL-NICKNAMES :PRECISE-ARG-COUNT-ERROR :RAW-INSTANCE-INIT-VOPS
 :SB-AFTER-XC-CORE :SB-CORE-COMPRESSION :SB-CORE-COMPRESSION :SB-DOC :SB-EVAL
 :SB-FUTEX :SB-LDB :SB-PACKAGE-LOCKS :SB-SIMD-PACK :SB-SOURCE-LOCATIONS
 :SB-TEST :SB-THREAD :SB-UNICODE :SB-XREF-FOR-INTERNALS :SB-XREF-FOR-INTERNALS
 :SBCL :STACK-ALLOCATABLE-CLOSURES :STACK-ALLOCATABLE-FIXED-OBJECTS
 :STACK-ALLOCATABLE-LISTS :STACK-ALLOCATABLE-VECTORS
 :STACK-GROWS-DOWNWARD-NOT-UPWARD :SYMBOL-INFO-VOPS :UNIX
 :UNWIND-TO-FRAME-AND-CALL-VOP :X86-64)

Changed in sbcl:
status: New → Fix Released
status: Fix Released → New
Revision history for this message
Jan Moringen (scymtym) wrote :

> with SBCL 1.3.7.61-5fc41bd

You appear to be using an unreleased version of SBCL. The problem you describe has likely been fixed a couple of commits later in

  a6d81f1 Fix sequence type derivation in the presence of negation types.

just before the 1.3.8 release. Please try to reproduce the problem with a released version or the current master.

Changed in sbcl:
status: New → Incomplete
Revision history for this message
Thomas Bartscher (thomas-bartscher-h) wrote :

I am sorry. Yes, that bug has been fixed.

Jan Moringen (scymtym)
Changed in sbcl:
status: Incomplete → 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.