comp: Make use of predicates in propagation for non builtin types

* lisp/emacs-lisp/comp-cstr.el (comp-cstr-ctxt): Add `pred-type-h'
slot.
* lisp/emacs-lisp/comp.el (comp-known-predicate-p)
(comp-pred-to-cstr): Update.
This commit is contained in:
Andrea Corallo 2022-08-24 23:31:28 +02:00
parent f4de81af8f
commit d03dd07774
2 changed files with 13 additions and 2 deletions

View file

@ -107,6 +107,14 @@ Integer values are handled in the `range' slot.")
(mapcar #'comp--cl-class-hierarchy (comp--all-classes)))
:type list
:documentation "Type hierarchy.")
(pred-type-h (cl-loop with h = (make-hash-table :test #'eq)
for class-name in (comp--all-classes)
for pred = (get class-name 'cl-deftype-satisfies)
when pred
do (puthash pred class-name h)
finally return h)
:type hash-table
:documentation "Hash pred -> type.")
(union-typesets-mem (make-hash-table :test #'equal) :type hash-table
:documentation "Serve memoization for
`comp-union-typesets'.")