Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extended sequences in the type system #1568

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/lisp/kernel/clos/boot.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@
(setq +the-std-class+ (find-class 'std-class nil))
(setq +the-funcallable-standard-class+
(find-class 'funcallable-standard-class nil)))

;; Undefine the SEQUENCE type expansion, which does not account
;; for extended sequences. Redefining SEQUENCE like this is a KLUDGE.
(setf (ext:type-expander 'sequence) nil)

;;
;; Finalize
;;
Expand Down
4 changes: 3 additions & 1 deletion src/lisp/kernel/cmp/opt/opt-type.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,9 @@
et
(upgraded-array-element-type et env)))))
((sequence)
`(or (listp object) (vectorp object)))
`(or (listp object) (vectorp object)
(subclassp (class-of object)
(load-time-value (find-class 'sequence)))))
((standard-char)
`(and (characterp object) (standard-char-p object)))
;; NOTE: Probably won't actually occur, due to normalization.
Expand Down
6 changes: 3 additions & 3 deletions src/lisp/kernel/lsp/predlib.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,9 @@ Returns T if X belongs to TYPE; NIL otherwise."
;; Note that if you decide to change this, you'll need to alter the
;; compiler macro (in cmp/opt-type.lisp) as well.
(COMPLEX (complexp object))
(SEQUENCE (or (listp object) (vectorp object)))
(SEQUENCE (or (listp object) (vectorp object)
(si:subclassp (class-of object)
(find-class 'sequence))))
(CONS (and (consp object)
(or (endp i)
(let ((car-type (first i)))
Expand Down Expand Up @@ -1223,8 +1225,6 @@ if not possible."
(core:simple-character-string (SIMPLE-ARRAY CHARACTER (*)))
(BIT-VECTOR (ARRAY BIT (*)))

(SEQUENCE (OR CONS (MEMBER NIL) (ARRAY * (*))))

(HASH-TABLE)
(PATHNAME)
(LOGICAL-PATHNAME NIL PATHNAME)
Expand Down
Loading