Constrain mvars under compare and branch with built-in predicates
* lisp/emacs-lisp/comp.el (comp-emit-assume): Update. (comp-known-predicate-p): New function. (comp-add-cond-cstrs): Extend to pattern match predicate calls. * lisp/emacs-lisp/comp-cstr.el (comp-cstr-null-p) (comp-pred-to-cstr): New function. * test/src/comp-tests.el (comp-tests-type-spec-tests): Add a number of tests and fix comments.
This commit is contained in:
parent
e83c6994e1
commit
c4efb49a27
3 changed files with 123 additions and 26 deletions
|
@ -137,6 +137,13 @@ Integer values are handled in the `range' slot.")
|
|||
(null (valset cstr))
|
||||
(null (range cstr)))))
|
||||
|
||||
(defsubst comp-cstr-null-p (x)
|
||||
"Return t if CSTR is equivalent to the `null' type specifier, nil otherwise."
|
||||
(with-comp-cstr-accessors
|
||||
(and (null (typeset x))
|
||||
(null (range x))
|
||||
(equal (valset x) '(nil)))))
|
||||
|
||||
(defun comp-cstrs-homogeneous (cstrs)
|
||||
"Check if constraints CSTRS are all homogeneously negated or non-negated.
|
||||
Return `pos' if they are all positive, `neg' if they are all
|
||||
|
@ -167,6 +174,10 @@ Return them as multiple value."
|
|||
:range '((1 . 1)))
|
||||
"Represent the integer immediate one (1).")
|
||||
|
||||
(defun comp-pred-to-cstr (predicate)
|
||||
"Given PREDICATE return the correspondig constraint."
|
||||
(comp-type-to-cstr (get predicate 'cl-satisfies-deftype)))
|
||||
|
||||
|
||||
;;; Value handling.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue