]> git.eshelyaron.com Git - emacs.git/commit
comp-cstr.el: The type hierarchy is a DAG, not a tree
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 30 Oct 2023 04:59:19 +0000 (00:59 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 30 Oct 2023 04:59:19 +0000 (00:59 -0400)
commitbdec2d2d464919572ae948ba8150e014aa649191
tree7cc0cfa5c7142b08707b9a8cc01bb401e356dfc8
parent271d8b70f8d772807484454d3369f515fdff350a
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.
lisp/emacs-lisp/cl-macs.el
lisp/emacs-lisp/cl-preloaded.el
lisp/emacs-lisp/comp-cstr.el
lisp/emacs-lisp/comp.el
test/lisp/emacs-lisp/comp-cstr-tests.el