Negate only values while constraining variables (bug#45376)

* lisp/emacs-lisp/comp-cstr.el (comp-cstr-value-negation): New
	function.
	* lisp/emacs-lisp/comp.el (comp-fwprop-insn): Use
	`comp-cstr-value-negation'.
	* test/src/comp-test-funcs.el (comp-test-45376-1-f): Rename.
	(comp-test-45376-2-f): New funcion.
	* test/src/comp-tests.el (bug-45376-1): Rename test.
	(bug-45376-2): Add test.
This commit is contained in:
Andrea Corallo 2020-12-23 15:51:55 +01:00
parent 0a89ed7a96
commit ffcd490cb4
4 changed files with 40 additions and 4 deletions

View file

@ -701,6 +701,20 @@ DST is returned."
(neg dst) (not (neg src)))
dst))
(defun comp-cstr-value-negation (dst src)
"Negate values in SRC setting the result in DST.
DST is returned."
(with-comp-cstr-accessors
(if (or (valset src) (range src))
(setf (typeset dst) ()
(valset dst) (valset src)
(range dst) (range src)
(neg dst) (not (neg src)))
(setf (typeset dst) (typeset src)
(valset dst) ()
(range dst) ()))
dst))
(defun comp-cstr-negation-make (src)
"Negate SRC and return a new constraint."
(comp-cstr-negation (make-comp-cstr) src))