(assert (type= (specifier-type 'cons)
(type-intersection (specifier-type 'sequence)
(specifier-type '(or cons number)))))
+(assert (type= (specifier-type '(simple-array character (*)))
+ (type-intersection (specifier-type 'sequence)
+ (specifier-type '(simple-array character)))))
+(assert (type= (specifier-type 'list)
+ (type-intersection (specifier-type 'sequence)
+ (specifier-type 'list))))
(assert (eql *empty-type*
(type-intersection (specifier-type '(satisfies keywordp))
*empty-type*)))
(type-union (specifier-type 'cons) (specifier-type 'null))))
(assert (type= (specifier-type 'list)
(type-union (specifier-type 'null) (specifier-type 'cons))))
+#+nil ; not any more
(assert (type= (specifier-type 'sequence)
(type-union (specifier-type 'list) (specifier-type 'vector))))
+#+nil ; not any more
(assert (type= (specifier-type 'sequence)
(type-union (specifier-type 'vector) (specifier-type 'list))))
(assert (type= (specifier-type 'list)
(specifier-type '(member #\b #\c #\f)))
(specifier-type '(member #\c))))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep 'package 'instance)
+ (assert yes)
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep 'symbol 'instance)
+ (assert (not yes))
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep 'package 'funcallable-instance)
+ (assert (not yes))
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep 'symbol 'funcallable-instance)
+ (assert (not yes))
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep 'funcallable-instance 'function)
+ (assert yes)
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep 'array 'instance)
+ (assert (not yes))
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep 'character 'instance)
+ (assert (not yes))
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep 'number 'instance)
+ (assert (not yes))
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep 'package '(and (or symbol package) instance))
+ (assert yes)
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep '(and (or double-float integer) instance) 'nil)
+ (assert yes)
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep '(and (or double-float integer) funcallable-instance) 'nil)
+ (assert yes)
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep 'instance 'type-specifier)
+ (assert yes)
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep 'type-specifier 'instance)
+ (assert (not yes))
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep '(and (function (t)) funcallable-instance) 'nil)
+ (assert (not yes)))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep '(and fixnum function) 'nil)
+ (assert yes)
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep '(and fixnum hash-table) 'nil)
+ (assert yes)
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep '(function) '(function (t &rest t)))
+ (assert (not yes))
+ (assert win))
+;; Used to run out of stack.
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep 'null '(or unk0 unk1))
+ (assert (not yes))
+ (assert (not win)))
+
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep '(and function instance) nil)
+ (assert yes)
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep nil '(and function instance))
+ (assert yes)
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep '(and function funcallable-instance) 'funcallable-instance)
+ (assert yes)
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep 'funcallable-instance '(and function funcallable-instance))
+ (assert yes)
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep 'stream 'instance)
+ (assert (not yes)))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep 'stream 'funcallable-instance)
+ (assert (not yes))
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep '(and stream instance) 'instance)
+ (assert yes)
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep '(and stream funcallable-instance) 'funcallable-instance)
+ (assert yes)
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep '(and stream instance) 'stream)
+ (assert yes)
+ (assert win))
+(multiple-value-bind (yes win)
+ (sb-xc:subtypep '(and stream funcallable-instance) 'stream)
+ (assert yes)
+ (assert win))
+
+(assert (type= (specifier-type 'nil)
+ (specifier-type '(and symbol funcallable-instance))))
+
(/show "done with tests/type.before-xc.lisp")