Update of /cvsroot/sbcl/sbcl/tests
In directory sc8prcvs1:/tmp/cvsserv5141/tests
Modified Files:
type.pure.lisp
Log Message:
0.7.12.31:
Yet another incremental extension to the type system algorithms.
In the presence of types such as (MEMBER 1 "foo" (X)), we
cannot hash VALUESSPECIFIERTYPE on EQUAL, because two
such types can contain the same or different (under EQL)
"foo" or (X), and yet be the same under EQUALity. So
... define a new function EQUALBUTNOCARRECURSION, which is
almost but not quite what it sounds (it tests strings
bitvectors and lists by EQL, not EQUAL);
... use it as the new test function for the
VALUESSPECIFIERTYPE hash table.
The presence of numeric types in NOT types can be problematic,
as Paul Dietz' test of (OR BIGNUM FIXNUM) showed. So
... work a lot harder in the NOT type translator, to bring
numeric types out: we treat (NOT (INTEGER a b)) as
(OR (NOT INTEGER) (INTEGER * a) (INTEGER b *)), with the
obvious generalizations.
Now (AND INTEGER (NOT FIXNUM)) parses as
`(OR (INTEGER * ,(1 MOSTNEGATIVEFIXNUM))
(INTEGER ,(1+ MOSTPOSITIVEFIXNUM))
which is right, but no longer an intersection type, so
... move BIGNUM unparsing from INTERSECTIONTYPE to UNIONTYPE.
Even with all this, we don't get (OR INTEGER RATIO) right, so
... teach the type system some more set theory, with new
HAIRYTYPE and INTERSECTION union methods.
Now (SUBTYPEP 'RATIONAL '(OR INTEGER RATIO)) returns T, T
(and all the people rejoiced!)
Index: type.pure.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/tests/type.pure.lisp,v
retrieving revision 1.8
retrieving revision 1.9
diff u d r1.8 r1.9
 type.pure.lisp 31 Jan 2003 15:08:32 0000 1.8
+++ type.pure.lisp 9 Feb 2003 20:20:42 0000 1.9
@@ 172,3 +172,12 @@
#+nil
(assert (and (subtypep 'function '(function))
(subtypep '(function) 'function)))
+
+;;; Absent any exciting generalizations of R, the type RATIONAL is
+;;; partitioned by RATIO and INTEGER. Ensure that the type system
+;;; knows about this. [ the type system is permitted to return NIL,
+;;; NIL for these, so if future maintenance breaks these tests that
+;;; way, that's fine. What the SUBTYPEP calls are _not_ allowed to
+;;; return is NIL, T, because that's completely wrong. ]
+(assert (subtypep '(or integer ratio) 'rational))
+(assert (subtypep 'rational '(or integer ratio)))
