diff options
| author | Stefan Monnier | 2023-10-30 00:59:19 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2023-10-30 00:59:19 -0400 |
| commit | bdec2d2d464919572ae948ba8150e014aa649191 (patch) | |
| tree | 7cc0cfa5c7142b08707b9a8cc01bb401e356dfc8 /test | |
| parent | 271d8b70f8d772807484454d3369f515fdff350a (diff) | |
| download | emacs-bdec2d2d464919572ae948ba8150e014aa649191.tar.gz emacs-bdec2d2d464919572ae948ba8150e014aa649191.zip | |
comp-cstr.el: The type hierarchy is a DAG, not a tree
Adjust the type operations to account for the fact that types can have
several parents.
* lisp/emacs-lisp/comp-cstr.el (comp--cl-class-hierarchy):
Use `cl--class-allparents`. Add FIXME.
(comp--direct-supertype): Declare obsolete.
(comp--direct-supertypes): New function.
(comp--normalize-typeset0): Rewrite to use `comp--direct-supertypes`;
adjust to account for the DAG structure; use `cl-set-difference`.
(comp--direct-subtypes): Rewrite.
(comp--intersection): New function.
(comp-supertypes): Rewrite and change return type.
(comp-subtype-p): Simplify.
(comp-union-typesets): Use `comp-supertypes` instead of iterating over
`comp-cstr-ctxt-typeof-types`.
* lisp/emacs-lisp/comp.el (comp--native-compile): Don't catch
errors if we're debugging.
* test/lisp/emacs-lisp/comp-cstr-tests.el: Adjust tests.
* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Fix mishap when we
evaluate (cl-defstruct cl-structure-object ..) during the compilation
of `cl-preloaded.el`.
* lisp/emacs-lisp/cl-preloaded.el: Add corresponding assertion.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/emacs-lisp/comp-cstr-tests.el | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/lisp/emacs-lisp/comp-cstr-tests.el b/test/lisp/emacs-lisp/comp-cstr-tests.el index d2f552af6fa..cbedce0c47d 100644 --- a/test/lisp/emacs-lisp/comp-cstr-tests.el +++ b/test/lisp/emacs-lisp/comp-cstr-tests.el | |||
| @@ -42,14 +42,14 @@ | |||
| 42 | ',expected-type-spec)))) | 42 | ',expected-type-spec)))) |
| 43 | 43 | ||
| 44 | (defconst comp-cstr-typespec-tests-alist | 44 | (defconst comp-cstr-typespec-tests-alist |
| 45 | `(;; 1 | 45 | '(;; 1 |
| 46 | (symbol . symbol) | 46 | (symbol . symbol) |
| 47 | ;; 2 | 47 | ;; 2 |
| 48 | ((or string array) . array) | 48 | ((or string array) . array) |
| 49 | ;; 3 | 49 | ;; 3 |
| 50 | ((or symbol number) . (or number symbol)) | 50 | ((or symbol number) . (or number symbol)) |
| 51 | ;; 4 | 51 | ;; 4 |
| 52 | ((or cons atom) . (or atom cons)) ;; SBCL return T | 52 | ((or cons atom) . t) ;; SBCL return T |
| 53 | ;; 5 | 53 | ;; 5 |
| 54 | ((or integer number) . number) | 54 | ((or integer number) . number) |
| 55 | ;; 6 | 55 | ;; 6 |
| @@ -219,14 +219,18 @@ | |||
| 219 | ;; 88 | 219 | ;; 88 |
| 220 | ((and (or (member a b c)) (not (or (member a b)))) . (member c)) | 220 | ((and (or (member a b c)) (not (or (member a b)))) . (member c)) |
| 221 | ;; 89 | 221 | ;; 89 |
| 222 | ((or cons symbol) . list) | 222 | ((or cons symbol) . (or list symbol)) ;; FIXME: Why `list'? |
| 223 | ;; 90 | 223 | ;; 90 |
| 224 | ((or string char-table bool-vector vector) . array) | 224 | ((or string char-table bool-vector vector) . array) |
| 225 | ;; 91 | 225 | ;; 91 |
| 226 | ((or string char-table bool-vector vector number) . (or array number)) | 226 | ((or string char-table bool-vector vector number) . (or array number)) |
| 227 | ;; 92 | 227 | ;; 92 |
| 228 | ((or string char-table bool-vector vector cons symbol number) . | 228 | ((or string char-table bool-vector vector cons symbol number) . |
| 229 | (or number sequence))) | 229 | (or number sequence symbol)) |
| 230 | ;; 93? | ||
| 231 | ;; FIXME: I get `cons' rather than `list'? | ||
| 232 | ;;((or null cons) . list) | ||
| 233 | ) | ||
| 230 | "Alist type specifier -> expected type specifier.")) | 234 | "Alist type specifier -> expected type specifier.")) |
| 231 | 235 | ||
| 232 | (defmacro comp-cstr-synthesize-tests () | 236 | (defmacro comp-cstr-synthesize-tests () |