aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorAndrea Corallo2020-12-18 18:37:16 +0100
committerAndrea Corallo2020-12-21 20:22:03 +0100
commit6f3570cd4a615caa02c3d86320049a5631ab9b25 (patch)
tree27bab0576314c686aba381a461bb9436f9261082 /test/src
parent9bbe6eab6c160a454f2705c00ff3aea7f0c6e6c1 (diff)
downloademacs-6f3570cd4a615caa02c3d86320049a5631ab9b25.tar.gz
emacs-6f3570cd4a615caa02c3d86320049a5631ab9b25.zip
Fix value type inference for doubly negate constraints
* lisp/emacs-lisp/comp.el (comp-fwprop-insn): Do not propagate in case of double negation. * test/src/comp-test-funcs.el (comp-test-assume-double-neg-f): New function. * test/src/comp-tests.el (assume-double-neg): New test.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/comp-test-funcs.el10
-rw-r--r--test/src/comp-tests.el4
2 files changed, 14 insertions, 0 deletions
diff --git a/test/src/comp-test-funcs.el b/test/src/comp-test-funcs.el
index 5fc032b127d..7f70fc2460c 100644
--- a/test/src/comp-test-funcs.el
+++ b/test/src/comp-test-funcs.el
@@ -395,6 +395,16 @@
395 (1 " ➊") (2 " ➋") (3 " ➌") (4 " ➍") (5 " ➎") (6 " ➏") 395 (1 " ➊") (2 " ➋") (3 " ➌") (4 " ➍") (5 " ➎") (6 " ➏")
396 (7 " ➐") (8 " ➑") (9 " ➒") (10 " ➓") (_ ""))) 396 (7 " ➐") (8 " ➑") (9 " ➒") (10 " ➓") (_ "")))
397 397
398(defun comp-test-assume-double-neg-f (collection value)
399 ;; Reduced from `auth-source-search-collection'.
400 (when (atom collection)
401 (setq collection (list collection)))
402 (or (eq value t)
403 ;; value is (not (member t))
404 (eq collection value)
405 ;; collection is t, not (member t)!
406 (member value collection)))
407
398 408
399;;;;;;;;;;;;;;;;;;;; 409;;;;;;;;;;;;;;;;;;;;
400;; Tromey's tests ;; 410;; Tromey's tests ;;
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index 8e069fb3082..eeff599de4c 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -401,6 +401,10 @@ https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
401<https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-12/msg01771.html>" 401<https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-12/msg01771.html>"
402 (should (string= " ➊" (comp-test-45342-f 1)))) 402 (should (string= " ➊" (comp-test-45342-f 1))))
403 403
404(comp-deftest assume-double-neg ()
405 "In fwprop assumtions (not (not (member x))) /= (member x)."
406 (should-not (comp-test-assume-double-neg-f "bar" "foo")))
407
404(defvar comp-test-primitive-advice) 408(defvar comp-test-primitive-advice)
405(comp-deftest primitive-advice () 409(comp-deftest primitive-advice ()
406 "Test effectiveness of primitive advicing." 410 "Test effectiveness of primitive advicing."