* lisp/emacs-lisp/comp-cstr.el (comp-cstr-one): New special var.
* lisp/emacs-lisp/comp.el (comp-fwprop-call): Propagate integer
ranges on +1 -1.
* test/src/comp-tests.el (comp-tests-type-spec-tests): Add two tests.
collect cstr into positives
finally return (cl-values positives negatives)))
+(defvar comp-cstr-one (make-comp-cstr :typeset ()
+ :range '((1 . 1)))
+ "Represent the integer immediate one (1).")
+
\f
;;; Value handling.
(comp-mvar-neg lval) (comp-cstr-neg cstr))))
(cl-case f
(+ (comp-cstr-add lval args))
- (- (comp-cstr-sub lval args)))))
+ (- (comp-cstr-sub lval args))
+ (1+ (comp-cstr-add lval `(,(car args) ,comp-cstr-one)))
+ (1- (comp-cstr-sub lval `(,(car args) ,comp-cstr-one))))))
(defun comp-fwprop-insn (insn)
"Propagate within INSN."
(< 1 j 5)
(< 1 k 5))
(+ x y z i j k)))
- (or null float (integer 12 24)))))
+ (or null float (integer 12 24)))
+
+ ;; 45
+ ((defun comp-tests-ret-type-spec-f (x)
+ (when (<= 1 x 5)
+ (1+ x)))
+ (or null float (integer 2 6)))
+
+ ;;46
+ ((defun comp-tests-ret-type-spec-f (x)
+ (when (<= 1 x 5)
+ (1- x)))
+ (or null float (integer 0 4)))))
(defun comp-tests-define-type-spec-test (number x)
`(comp-deftest ,(intern (format "ret-type-spec-%d" number)) ()