diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2020-10-31 14:16:25 +0100 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2020-10-31 14:31:43 +0100 |
commit | 0cbcc6223a75fee4af9211107ed392cb987c0a91 (patch) | |
tree | 6340c9eace70a0957d1e0ee97b3289dc504a2f3b /test/lisp/emacs-lisp | |
parent | 8d72075aeb58e3b8eb91c78c4f51076d12d22263 (diff) | |
download | emacs-0cbcc6223a75fee4af9211107ed392cb987c0a91.tar.gz emacs-0cbcc6223a75fee4af9211107ed392cb987c0a91.tar.bz2 emacs-0cbcc6223a75fee4af9211107ed392cb987c0a91.zip |
'assoc' is not side-effect-free; constprop its pure subset
Since a supplied test function can do anything, assoc is not
side-effect-free (bug#44018). However, with only two arguments it is
pure and should be optimised accordingly.
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Remove 'assoc'.
(byte-optimize-assoc): Constant-propagate through 2-arg assoc calls.
* test/lisp/emacs-lisp/bytecomp-tests.el
(byte-opt-testsuite-arith-data): Add test cases.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r-- | test/lisp/emacs-lisp/bytecomp-tests.el | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index ea5aacd7912..13cbedfe1f7 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -365,7 +365,12 @@ '(((a b)) a b (c) (d))) (mapcar (lambda (x) (cond ((memq '(a b) x) 1) ((equal x '(c)) 2))) - '(((a b)) a b (c) (d)))) + '(((a b)) a b (c) (d))) + + (assoc 'b '((a 1) (b 2) (c 3))) + (assoc "b" '(("a" 1) ("b" 2) ("c" 3))) + (let ((x '((a 1) (b 2) (c 3)))) (assoc 'c x)) + (assoc 'a '((a 1) (b 2) (c 3)) (lambda (u v) (not (equal u v))))) "List of expression for test. Each element will be executed by interpreter and with bytecompiled code, and their results compared.") |