Initial constraint negation support

* lisp/emacs-lisp/comp-cstr.el (comp-cstr): Add `neg' slot.
	(comp-range-negation, comp-cstr-negation)
	(comp-cstr-negation-make): New functions.
	(comp-type-spec-to-cstr): Enable `not` in type specifiers.
	(comp-cstr-to-type-spec): Update logic to handle negation.
	* test/lisp/emacs-lisp/comp-cstr-tests.el
	(comp-cstr-typespec-tests-alist): Add a test.
This commit is contained in:
Andrea Corallo 2020-12-02 21:44:00 +01:00
parent eb8d15547b
commit 9b85ae6aa5
2 changed files with 50 additions and 18 deletions

View file

@ -77,7 +77,8 @@
((and (integer -1 2) (integer 3 5)) . nil)
((and (integer -1 3) (integer 3 5)) . (integer 3 3))
((and (integer -1 4) (integer 3 5)) . (integer 3 4))
((and (integer -1 5) nil) . nil))
((and (integer -1 5) nil) . nil)
((not symbol) . (not symbol)))
"Alist type specifier -> expected type specifier.")
(defmacro comp-cstr-synthesize-tests ()