diff options
| author | Andrea Corallo | 2020-12-23 15:51:55 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2020-12-23 16:17:58 +0100 |
| commit | ffcd490cb49ba86d625288ea425d98e8cac22a05 (patch) | |
| tree | 342f35499da56dff6dcb4d4066818492796194ca /test/src | |
| parent | 0a89ed7a962e22892e9c700cfca188197af2a6ad (diff) | |
| download | emacs-ffcd490cb49ba86d625288ea425d98e8cac22a05.tar.gz emacs-ffcd490cb49ba86d625288ea425d98e8cac22a05.zip | |
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.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/comp-test-funcs.el | 20 | ||||
| -rw-r--r-- | test/src/comp-tests.el | 8 |
2 files changed, 25 insertions, 3 deletions
diff --git a/test/src/comp-test-funcs.el b/test/src/comp-test-funcs.el index d6bcfca2d94..7731e6547b1 100644 --- a/test/src/comp-test-funcs.el +++ b/test/src/comp-test-funcs.el | |||
| @@ -417,7 +417,7 @@ | |||
| 417 | (setq args (cons (substring arg start pos) args)))) | 417 | (setq args (cons (substring arg start pos) args)))) |
| 418 | args)) | 418 | args)) |
| 419 | 419 | ||
| 420 | (defun comp-test-45376-f () | 420 | (defun comp-test-45376-1-f () |
| 421 | ;; Reduced from `eshell-ls-find-column-lengths'. | 421 | ;; Reduced from `eshell-ls-find-column-lengths'. |
| 422 | (let* (res | 422 | (let* (res |
| 423 | (len 2) | 423 | (len 2) |
| @@ -431,6 +431,24 @@ | |||
| 431 | i (1+ i))) | 431 | i (1+ i))) |
| 432 | res)) | 432 | res)) |
| 433 | 433 | ||
| 434 | (defun comp-test-45376-2-f () | ||
| 435 | ;; Also reduced from `eshell-ls-find-column-lengths'. | ||
| 436 | (let* ((x 1) | ||
| 437 | res) | ||
| 438 | (while x | ||
| 439 | (let* ((y 4) | ||
| 440 | (i 0)) | ||
| 441 | (while (> y 0) | ||
| 442 | (when (= i x) | ||
| 443 | (setq i 0)) | ||
| 444 | (setf res (cons i res)) | ||
| 445 | (setq y (1- y) | ||
| 446 | i (1+ i))) | ||
| 447 | (if (>= x 3) | ||
| 448 | (setq x nil) | ||
| 449 | (setq x (1+ x))))) | ||
| 450 | res)) | ||
| 451 | |||
| 434 | 452 | ||
| 435 | ;;;;;;;;;;;;;;;;;;;; | 453 | ;;;;;;;;;;;;;;;;;;;; |
| 436 | ;; Tromey's tests ;; | 454 | ;; Tromey's tests ;; |
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 5f2d702fca0..e0d4bf8df5e 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el | |||
| @@ -409,9 +409,13 @@ https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html." | |||
| 409 | "Broken call args assumptions lead to infinite loop." | 409 | "Broken call args assumptions lead to infinite loop." |
| 410 | (should (equal (comp-test-assume-in-loop-1-f "cd") '("cd")))) | 410 | (should (equal (comp-test-assume-in-loop-1-f "cd") '("cd")))) |
| 411 | 411 | ||
| 412 | (comp-deftest bug-45376 () | 412 | (comp-deftest bug-45376-1 () |
| 413 | "<https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-12/msg01883.html>" | 413 | "<https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-12/msg01883.html>" |
| 414 | (should (equal (comp-test-45376-f) '(1 0)))) | 414 | (should (equal (comp-test-45376-1-f) '(1 0)))) |
| 415 | |||
| 416 | (comp-deftest bug-45376-2 () | ||
| 417 | "<https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-12/msg01883.html>" | ||
| 418 | (should (equal (comp-test-45376-2-f) '(0 2 1 0 1 0 1 0 0 0 0 0)))) | ||
| 415 | 419 | ||
| 416 | (defvar comp-test-primitive-advice) | 420 | (defvar comp-test-primitive-advice) |
| 417 | (comp-deftest primitive-advice () | 421 | (comp-deftest primitive-advice () |